Kafka creates topic error: org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 1 larger than available brokers: 0.

kafka executes the following statement to create a topic.
[root@node01 kafka_2.11-1.0.0]# bin/kafka-topics.sh –create –topic streaming-test –replication-factor 1 –partitions 3 –zookeeper node01:2181,node02:2181,node03:2181
Error while executing topic command : Replication factor: 1 larger than available brokers: 0.
Error:[2019-10-15 20:23:25,461] ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 1 larger than available brokers: 0.
Reason: The configuration item zookeeper.connect in the broker’s configuration file server.properties specifies the root directory of kafka’s zookeeper (zookeeper.connect=node01:2181,node02:2181,node03:2181/kafka)
Solution: The value of the command line parameter “–zookeeper” also needs to bring the root directory, as follows.
bin/kafka-topics.sh –create –topic streaming-test –replication-factor 1 –partitions 3 –zookeeper node01:2181,node02:2181,node03:2181/kafka

Similar Posts: