Kafka创建Topic出现replication factor: 2 larger than available brokers: 0 减少replication factor还是出现错误的解决办法

Posted 《@书山有径%》

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Kafka创建Topic出现replication factor: 2 larger than available brokers: 0 减少replication factor还是出现错误的解决办法相关的知识,希望对你有一定的参考价值。

Kafka创建Topic出现replication factor: 2 larger than available brokers: 0 减少replication factor还是出现错误的解决办法

kafka-topics.sh --zookeeper hbase:2181 --create --topic ct --partitions 3 --replication-factor 2

[root@hbase kafka]# bin/kafka-topics.sh --zookeeper hbase:2181 --create --topic ct --partitions 3 --replication-factor 2
Error while executing topic command : replication factor: 2 larger than available brokers: 0
[2022-01-16 04:24:57,896] ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: replication factor: 2 larger than available brokers: 0
(kafka.admin.TopicCommand$)

错误

出现这样情况是因为kafka的节点只有1个,但是备份却大于1个.所以减少备份数目

kafka-topics.sh --zookeeper hbase:2181 --create --topic ct --partitions 3 --replication-factor 1

出现这种情况

Error while executing topic command : replication factor: 1 larger than available brokers: 0
[2022-01-16 04:26:46,096] ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: replication factor: 1 larger than available brokers: 0

这就奇怪了明明已经减少了备份数量还是出现了错误

解决办法

修改创建Topic指令,创建成功

kafka-topics.sh --create -zookeeper hbase:2181 --topic ct --partitions 3 --replication-factor 1

以上是关于Kafka创建Topic出现replication factor: 2 larger than available brokers: 0 减少replication factor还是出现错误的解决办法的主要内容,如果未能解决你的问题,请参考以下文章

kafka

kafka创建topic报错

Kafka创建&查看topic,生产&消费指定topic消息

怎么设置kafka topic数据存储时间

kafka命令使用

kafka 创建topic 并使用java/.net 连接