kafka注册异常
问题描述:
kafka注册异常,提示brokers id已经被注册过
19-02-22 14:43:51,393] FATAL [Kafka Server 1], Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer) java.lang.RuntimeException: A broker is already registered on the path /brokers/ids/1. 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. at kafka.utils.ZkUtils.registerBrokerInZk(ZkUtils.scala:417) at kafka.utils.ZkUtils.registerBrokerInZk(ZkUtils.scala:403) at kafka.server.KafkaHealthcheck.register(KafkaHealthcheck.scala:70) at kafka.server.KafkaHealthcheck.startup(KafkaHealthcheck.scala:50) at kafka.server.KafkaServer.startup(KafkaServer.scala:280) at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38) at kafka.Kafka$.main(Kafka.scala:65) at kafka.Kafka.main(Kafka.scala) [2019-02-22 14:43:51,401] INFO [Kafka Server 1], shutting down (kafka.server.KafkaServer)
问题解决:
根据日志提示/brokers 已经在zookeeper注册,所以需要在zookeeper中删除/brokers,或者修改kafka的server.properties配置文件的broker id
ls / 查看zookeeper中根目录
rmr /brokers 删除kafka-brokers在zookeeper