Java 阿帕奇·卡夫卡路径

Java 阿帕奇·卡夫卡路径,java,apache-kafka,apache-zookeeper,apache-storm,Java,Apache Kafka,Apache Zookeeper,Apache Storm,我有一个应用程序可以设置与卡夫卡主题的storm连接。我模仿我们组织中另一个类似回购协议的设置具有如下属性: zookeeper.connect=127.0.0.1:2181/kafka_0.9 org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /brokers/topics/Moment_2018_01_16_07_59_08/partitions at org.apache.

我有一个应用程序可以设置与卡夫卡主题的storm连接。我模仿我们组织中另一个类似回购协议的设置具有如下属性:

zookeeper.connect=127.0.0.1:2181/kafka_0.9
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /brokers/topics/Moment_2018_01_16_07_59_08/partitions
at org.apache.zookeeper.KeeperException.create(KeeperException.java:111) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1590) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:214) ~[curator-framework-2.5.0.jar:na]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:203) ~[curator-framework-2.5.0.jar:na]
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107) ~[curator-client-2.5.0.jar:na]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:199) ~[curator-framework-2.5.0.jar:na]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:191) ~[curator-framework-2.5.0.jar:na]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:38) ~[curator-framework-2.5.0.jar:na]
at storm.kafka.DynamicBrokersReader.getNumPartitions(DynamicBrokersReader.java:91) ~[storm-kafka-0.9.6.jar:na]
我发现,在本地开发环境中,使用此设置时,我的应用程序在尝试创建storm spout时会抛出一个错误。错误被跟踪到对的调用。详细的错误日志如下所示:

zookeeper.connect=127.0.0.1:2181/kafka_0.9
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /brokers/topics/Moment_2018_01_16_07_59_08/partitions
at org.apache.zookeeper.KeeperException.create(KeeperException.java:111) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1590) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:214) ~[curator-framework-2.5.0.jar:na]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:203) ~[curator-framework-2.5.0.jar:na]
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107) ~[curator-client-2.5.0.jar:na]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:199) ~[curator-framework-2.5.0.jar:na]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:191) ~[curator-framework-2.5.0.jar:na]
at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:38) ~[curator-framework-2.5.0.jar:na]
at storm.kafka.DynamicBrokersReader.getNumPartitions(DynamicBrokersReader.java:91) ~[storm-kafka-0.9.6.jar:na]
当我从属性中取出尾随的
/kafka_0.9
时,如下所示:

zookeeper.connect=127.0.0.1:2181
然后这个错误消失了。我的推测是,我们组织的代码在staging&prod环境中有一个特定的路径
/kafka_0.9
设置(可能指定使用kafka 0.9)。但我想知道如何在本地开发环境中创建此路径,以便与登台和生产环境保持一致?目前,my
docker compose.yml
为zookeeper和kafka提供了以下功能:

zookeeper:
  image: myorg/zookeeper:3.4.8
  ports:
    - "2181:2181"

kafka:
  image: myorg/kafka:kafka-0.10
  hostname: myapp.docker
  ports:
    - "9092:9092"
  environment:
    EXPOSED_HOST: myapp.docker
    KAFKA_PORT: 9092
    KAFKA_ADVERTISED_PORT: 9092
    ZOOKEEPER_PORT_2181_TCP_ADDR: zookeeper
    ZOOKEEPER_PORT_2181_TCP_PORT: 2181
    ZOOKEEPER_IP: zookeeper
  links:
    - zookeeper
  extra_hosts:
    - "localhost:0.0.0.0"

尝试添加环境变量:
CHROOT=/kafka\u 0.9

Zookeeper还允许您添加一个“chroot”路径,这将使所有 此群集的kafka数据显示在特定路径下。这是一个 在同一台计算机上设置多个Kafka群集或其他应用程序的方法 动物园管理员集群。为此,请在表单中提供一个连接字符串 hostname1:port1,hostname2:port2,hostname3:port3/chroot/path 将把这个集群的所有数据放在path/chroot/path下。注 您必须在启动代理之前自己创建此路径 和使用者必须使用相同的连接字符串


尝试添加环境变量:
CHROOT=/kafka\u 0.9

Zookeeper还允许您添加一个“chroot”路径,这将使所有 此群集的kafka数据显示在特定路径下。这是一个 在同一台计算机上设置多个Kafka群集或其他应用程序的方法 动物园管理员集群。为此,请在表单中提供一个连接字符串 hostname1:port1,hostname2:port2,hostname3:port3/chroot/path 将把这个集群的所有数据放在path/chroot/path下。注 您必须在启动代理之前自己创建此路径 和使用者必须使用相同的连接字符串