Kafka to zookeeper command throws an error

bin/kafka-topics.sh --create --topic activityTopic --zookeeper localhost:2181/kafka --partitions 1 --replication-factor 1 

The above command from kafka throws an error

 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) 

Any idea?

+7
apache-zookeeper apache-kafka
source share
4 answers

In my case, the problem was that I pointed out the nonexistent chroot kafka.

I found that our ops team configured chroot kafka as purple-elephants and configured to create this chroot to ensure that the kafka service restarts.

First I released sudo service kafka restart , and the log shows that chroot was created:

 Ensuring chroot '/purple-elephants' exists Starting Kafka server. 

Then I just wrote:

 bin/kafka-topics.sh --create --topic activityTopic --zookeeper localhost:2181/purple-elephants --partitions 1 --replication-factor 1 
+2
source share

Try removing / kafka as the command

 bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 3 --topic Falcon 

If this still happens, make sure the path in zookeeper.properties

 dataDir(default is /tmp/zookeeper) 

and path in server.properties

 log.dirs(default is /tmp/kafka-logs) 
+1
source share

when creating a theme, this should be the zookeeper url with the --zookeeper parameter. It should work on the next line if zookeeper and kafka work.

 --zookeeper localhost:2181 

This link describes how to create a theme. You can also check for missing identifiers in zookeeper cli. ./zkCli.sh and then ls /brokers/ids . When renting, one broker identifier should be displayed.

0
source share

In my case, I only started zookeeper and forgot to start the kafka server. I also started the kafka server and then created a theme. The team worked fine.

0
source share

All Articles