kafka 创建topic时出现如下异常:
Error while executing topic command org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /brokers/ids
org.I0Itec.zkclient.exception.ZkNoNodeException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /brokers/ids
at org.I0Itec.zkclient.exception.ZkException.create(ZkException.java:47)
at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:685)
at org.I0Itec.zkclient.ZkClient.getChildren(ZkClient.java:413)
at org.I0Itec.zkclient.ZkClient.getChildren(ZkClient.java:409)
at kafka.utils.ZkUtils$.getChildren(ZkUtils.scala:462)
at kafka.utils.ZkUtils$.getSortedBrokerList(ZkUtils.scala:78)
at kafka.admin.AdminUtils$.createTopic(AdminUtils.scala:170)
at kafka.admin.TopicCommand$.createTopic(TopicCommand.scala:93)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:55)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /brokers/ids
at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1472)
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1500)
at org.I0Itec.zkclient.ZkConnection.getChildren(ZkConnection.java:99)
at org.I0Itec.zkclient.ZkClient$2.call(ZkClient.java:416)
at org.I0Itec.zkclient.ZkClient$2.call(ZkClient.java:413)
at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:675)
... 8 more
在之前的版本中一直没有这样问题,当kafka安装成功时通过集群查看一切都是正常的,但是创建topic确始终提示找不到节点,一开始是用如下命令创建的,这是照 前文档和其它资料做的:
kafka-topics.sh --create --topic firsttopic --replication-factor 2 --partitions 2 --zookeeper slave1:2181 用这个命令始报上述异常。最后试着把他zookeeper集群全路径写上,结果就成功创建了,用如下命令:
kafka-topics.sh --create --topic firsttopic --replication-factor 2 --partitions 2 --zookeeper slave1:2181/kafka
本文出自 “JAVAWEB” 博客,请务必保留此出处http://472053211.blog.51cto.com/3692116/1655844
kafkakafka_2.10-0.8.2.1+zookeeper-3.4.6 创建topic一个小问题
原文地址:http://472053211.blog.51cto.com/3692116/1655844