replication factor: 1 larger than available brokers: 0

从一个楼主那边得到的,自己就转过来了

Error while executing topic command : Replication factor: 1 larger than available brokers: 0.
[2017-12-17 22:46:20,950] ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 1 larger than available brokers: 0.
 (kafka.admin.TopicCommand$)

首先我们看错误信息“1 larger than available brokers: 0”,意思是至少有一个brokers.也就是说并没有有效的brokers可以用。

所以第一步你需要检查你是否已经创建了brokers,并且保证kafka已经启动。

如果你的kafka已经成功启动成功,并且brokers也已经创建并启动成功,还是报这个错误,有可能是你的kafka版本和zookeeper版本不匹配,最好是都是32位和64位的,其他原因我们暂且不说,我就给大家分享一下我遇到的这样尴尬情况 

我的原因是 创建topic时 zookeeper的路径不正确。  .\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181/kafka --replicati
on-factor 1 --partitions 1 --topic test2

先查看你的kafka配置文件里是如何配置的。切记创建topic时,zookeeper的路径一定要和你kafka配置文件里的路径一致 ,如下面红色部分。

############################# Zookeeper #############################

# Zookeeper connection string (see zookeeper docs for details).
# This is a comma separated host:port pairs, each corresponding to a zk
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
# You can also append an optional chroot string to the urls to specify the
# root directory for all kafka znodes.
zookeeper.connect=localhost:2181/kafka


# Timeout in ms for connecting to zookeeper
zookeeper.connection.timeout.ms=6000


原文链接:https://blog.csdn.net/g1219371445/article/details/78828915

你可能感兴趣的:(Liunx)