Support Questions
Find answers, ask questions, and share your expertise

Error while executing topic command : replication factor: 1 larger than available brokers: 0

Explorer

Hi there,

This is the command I ran.

bin/kafka-topics.sh --create --zookeeper cmtoldhwdpadm03.dev.bmocm.com:2181 --replication-factor 1 --partitions 1 --topic test21 Error while executing topic command : replication factor: 1 larger than available brokers: 0

I am getting the below error.

 ERROR kafka.admin.AdminOperationException: replication factor: 1 larger than available brokers: 0
        at kafka.admin.AdminUtils$.assignReplicasToBrokers(AdminUtils.scala:117)
        at kafka.admin.AdminUtils$.createTopic(AdminUtils.scala:403)
        at kafka.admin.TopicCommand$.createTopic(TopicCommand.scala:110)
        at kafka.admin.TopicCommand$.main(TopicCommand.scala:61)
        at kafka.admin.TopicCommand.main(TopicCommand.scala)
 (kafka.admin.TopicCommand$)


But, I am seeing in Ambari, There are two brokers has been started. Please help me. Thanks.

16 REPLIES 16

Explorer

Hi, here i have attached the zookeeper screenshot for your reference. zookeeper-screenshot.png

Expert Contributor

understand that your zookeeper is running. Want you to run zkCli at the command line, so that we can check whether it can connect from nodes to the zookeeper server.

Expert Contributor

not sure what are the url for your zookeeper sever. you should run as /usr/hdp/current/zookeeper-server/bin/zkCli.sh -server cmtoldhwdpadm03.dev.bmocm.com:2181 if cmtoldhwdpadm03.dev.bmocm.com is your zookeeper server.

Explorer

I ran as you said. This is the screenshot for the output.

zoo-out.png

Expert Contributor

from your picture, it looks like you have a zookeeper on cmtoldhwdpadm01.dev.bmocm.com, how about cmtoldhwdpadm02, and cmtoldhwdpadm03? Are there zookeeper running on those two?

Now, please follow the steps below:

/usr/hdp/current/zookeeper-server/bin/zkCli.sh -server cmtoldhwdpadm01.dev.bmocm.com

ls /brokers/ids/ <-- here you should see two ids as there are two broker nodes

get /brokers/ids/<id1> and <id2> <--- Please share the output

Cloudera Employee

Hi,

Just check the value of "zookeeper.chroot"(znode in ZooKeeper used as a root for Kafka cluster) property in your Kafka configurations. According to the command, which you have mentioned, it should be '/'.

i.e connect to the correct znode for kafka.

New Contributor

I too had the same issue.

Check for zookeeper.chroot value. As zookeeper and Kafka have tight integration.

In my case i had given /kafka.