最初的错误:
DynamicBrokersReader [ERROR] Node /brokers/ids/0 does not exist
设置:
BrokerHosts brokerHosts = new ZkHosts(zks, "/kafka/brokers");
然后就是如下错误:
2016-04-13T15:07:10.657+0800 b.s.util [ERROR] Async loop died! java.lang.RuntimeException: java.lang.RuntimeException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /kafka/brokers/topics/testtopic/partitions at storm.kafka.DynamicBrokersReader.getBrokerInfo(DynamicBrokersReader.java:81) ~[storm-kafka-0.9.6.jar:0.9.6] at storm.kafka.trident.ZkBrokerReader.<init>(ZkBrokerReader.java:42) ~[storm-kafka-0.9.6.jar:0.9.6] at storm.kafka.KafkaUtils.makeBrokerReader(KafkaUtils.java:57) ~[storm-kafka-0.9.6.jar:0.9.6] at storm.kafka.KafkaSpout.open(KafkaSpout.java:87) ~[storm-kafka-0.9.6.jar:0.9.6] at backtype.storm.daemon.executor$fn__3371$fn__3386.invoke(executor.clj:529) ~[storm-core-0.9.6.jar:0.9.6] at backtype.storm.util$async_loop$fn__460.invoke(util.clj:461) ~[storm-core-0.9.6.jar:0.9.6] at clojure.lang.AFn.run(AFn.java:24) [clojure-1.5.1.jar:na] at java.lang.Thread.run(Thread.java:662) [na:1.6.0_38] Caused by: java.lang.RuntimeException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /kafka/brokers/topics/testtopic/partitions at storm.kafka.DynamicBrokersReader.getNumPartitions(DynamicBrokersReader.java:94) ~[storm-kafka-0.9.6.jar:0.9.6] at storm.kafka.DynamicBrokersReader.getBrokerInfo(DynamicBrokersReader.java:65) ~[storm-kafka-0.9.6.jar:0.9.6] ... 7 common frames omitted
分析发现,在
DynamicBrokersReader类中虽然读取的是zkPath但是,前面的连接地址已经有了前缀地址,所以后面不用再加上
去掉了还是报最初的错误,再分析
在zkCli.sh进入zookeeper后检查,确实没有0,只有1,2,3这是在配置kafka时就定义的id了
在kafka/config/server.properties中配置broker.id = 0(其他机器顺序配置),重启,问题解决!
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/193474.html