Kafka错误:java.lang.RuntimeException: A broker is already registered on the path /brokers/ids/0. This
程序员文章站
2022-03-15 22:58:06
...
java.lang.RuntimeException: A broker is already registered on the path /brokers/ids/0. This probably indicates that you either have configured a brokerid that is already in use, or else you have shutdown this broker and restarted it faster than the zookeeper timeout so it appears to be re-registering.
翻译了一下:
. lang。RuntimeException:代理已经在路径/brokers/ids/0上注册。这可能表明您已经配置了一个已经在使用的brokerid,或者您已经比zookeeper超时更快地关闭并重新启动了这个代理,所以它看起来是在重新注册。
原因是因为 Kafka启动的时候需要向Zookeeper注册自己,如果你 broker.id已经在Zookeeper注册临时节点列表存在,就会出现这个问题. 解决办法就是broker.id换别的值,只要是当前Zookeeper里面临时节点没有.broker.id对应的值就行.
解决
修改文件kafka_2.11-0.11.0.2/config/server.properties
的 broker.id 配置,
重新运行
[aaa@qq.com config]# sh /root/soft/kafka_2.11-0.11.0.2/bin/kafka-server-start.sh -daemon $KAFKA_HOME/config/server.properties
# 已经有了Kafka进程 说明解决
[aaa@qq.com config]# jps
92370 DataNode
92914 NodeManager
116055 Jps
92201 NameNode
115995 Kafka
[aaa@qq.com config]#