zoukankan      html  css  js  c++  java
  • 使用不同的namespace让不同的kafka/Storm连接同一个zookeeper

    背景介绍:

     需要部署2个kafka独立环境,但是只有一个zookeeper集群。

    需要部署2个独立的storm环境,但是只有一个zookeeper集群。

    --------------------------

    kafka配置

    --------------------------

    kafka的config/server.properties中通过zookeeper.connect配置zookeeper,通常情况下,我们配置

    zookeeper.connect=192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181

    这个时候,如果两个kafka的broker.id都为0的话,第二个kafka无法启动,启动时会报异常:

    java.lang.RuntimeException: A broker is already registered on the path /brokers/ids/0. This probably indicates that you either have configured a brokerid that is already in use, or else you have shutdown this broker and restarted it faster than the zookeeper timeout so it appears to be re-registering.

    如果修改第二个kafka的broker.id,则kafka变成了一个集群,而我想要的是两套独立的kafka使用同一个zk。

    此时需要使用zk的命名空间进行配置,只需要在zookeeper.connect配置后,定义不同的命名空间即可,kafka启动后,会在zk上自动创建命名空间。

    kafka1:zookeeper.connect=192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181/kafka_namespace1

    kafka2:zookeeper.connect=192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181/kafka_namespace2

    -------------------------------------------------------------------------------------------------------

    ------------------

    storm配置

    ------------------

    在storm.yaml(${STORM_HOME}/conf目录下)中,配置

    Storm 1:

    storm.zookeeper.servers:
    - "192.168.1.101"
    - "192.168.1.102"
    - "192.168.1.103"

     storm.zookeeper.root: "/storm_xxxx"

    Storm 2:

    storm.zookeeper.servers:
    - "192.168.1.101"
    - "192.168.1.102"
    - "192.168.1.103"

     storm.zookeeper.root: "/storm_ssss"

  • 相关阅读:
    Appium原理分析
    HTTPRunner 升级到2.0
    接口测试库requests 及常用断言库
    HTTP协议基础总结
    阿里云专属推荐码nuyxa6
    WHY JAVASCRIPT NEEDS TYPES
    BUILDING ANGULAR APPS USING FLUX ARCHITECTURE
    TWO PHASES OF ANGULAR 2 APPLICATIONS
    Forms in Angular 2
    CHANGE DETECTION IN ANGULAR 2
  • 原文地址:https://www.cnblogs.com/yimiyan/p/9519798.html
Copyright © 2011-2022 走看看