卡夫卡到zookeeper命令产生错误
bin/kafka-topics.sh --create --topic activityTopic --zookeeper localhost:2181/kafka --partitions 1 --replication-factor 1
以上来自kafka的命令会产生错误
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)
任何想法?
就我而言,问题在于我指定了一个不存在的kafka chroot。
我发现我们公司的操作团队已经将卡夫卡chroot配置为purple-elephants
,并且配置了在kafka服务重启时保证这个chroot的创建。
首先,我发布了sudo service kafka restart
,日志显示chroot已创建:
Ensuring chroot '/purple-elephants' exists
Starting Kafka server.
然后我简单地发出:
bin/kafka-topics.sh --create --topic activityTopic --zookeeper localhost:2181/purple-elephants --partitions 1 --replication-factor 1
尝试按照命令删除/ kafka
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 3 --topic Falcon
如果它仍然存在,那么确保zookeeper.properties中的路径
dataDir(default is /tmp/zookeeper)
和路径在server.properties中
log.dirs(default is /tmp/kafka-logs)
在创建主题时,它应该是带有--zookeeper选项的zookeeper url。 如果zookeeper&kafka正在工作,它应该运行以下行。
--zookeeper localhost:2181
此链接描述如何创建主题。 你也可以在zookeeper cli中检查可用的id号。 ./zkCli.sh
然后ls /brokers/ids
。 至少应显示一个经纪人编号。
上一篇: Kafka to zookeeper command produces error
下一篇: ThreadGroup in Java