Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka to zookeeper command produces error

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

The above command from kafka produces 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?

like image 824
Thanga Avatar asked Feb 01 '16 08:02

Thanga


People also ask

Why is Kafka removing ZooKeeper?

Replacing ZooKeeper with internally managed metadata will improve scalability and management, according to Kafka's developers. Change is coming for users of Apache Kafka, the leading distributed event-streaming platform.

How ZooKeeper works with Kafka?

At a detailed level, ZooKeeper handles the leadership election of Kafka brokers and manages service discovery as well as cluster topology so each broker knows when brokers have entered or exited the cluster, when a broker dies and who the preferred leader node is for a given topic/partition pair.

Does Kafka 3.1 need ZooKeeper?

In Kafka architecture, Zookeeper serves as a centralized controller for managing all the metadata information about Kafka producers, brokers, and consumers. However, you can install and run Kafka without Zookeeper.


1 Answers

In my case, the problem was that I was specifying a non-existent kafka chroot.

I discovered that our company ops team had configured the kafka chroot as purple-elephants, and configured the creation of this chroot to be ensured on kafka service restart.

First I issued a sudo service kafka restart and the log shows that the chroot was created:

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

Then I simply issued:

bin/kafka-topics.sh --create --topic activityTopic --zookeeper localhost:2181/purple-elephants --partitions 1 --replication-factor 1
like image 136
Charney Kaye Avatar answered Oct 04 '22 18:10

Charney Kaye