Kafka报错:kafka.common.InconsistentBrokerIdException
问题背景:一台装过kafka的机器再重新安装kafka并启动时(log.dirs没有更改),会报错:
FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentBrokerIdException: Configured broker.id 1 doesn’t match stored broker.id 3 in meta.properties. If you moved your data, make sure your configured broker.id matches. If you intend to create a new broker, you should remove all data in your data directories (log.dirs).
at kafka.server.KafkaServer.getBrokerId(KafkaServer.scala:688)
at kafka.server.KafkaServer.startup(KafkaServer.scala:194)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:39)
at kafka.Kafka$.main(Kafka.scala:67)
at kafka.Kafka.main(Kafka.scala)
log.dirs的目录
原因:由于 两次启动不同的kafka(版本不同),将broker的信息存入到相同目录下,产生错误,也有可能是同一版本两次启动启动之间,是记录信息的错误,集群中,各个节点配置文件meta.properties 存在相同的broker.id,
解决方法:把这个log.dirs目录下文件全部删除即可。