一、Kafka关闭后,再次启动失败问题
问题描述:kafka关闭后,再次重启失败,异常日志如下:
[2022-02-17 16:13:40,739] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentClusterIdException: The Cluster ID NAdv6Mq7Qoy-g0ui7WV-9g doesn't match stored clusterId Some(qyuVCe-ST_C39fp34FEV8Q) in meta.properties. The broker is trying to join the wrong cluster. Configured zookeeper.connect may be wrong.
at kafka.server.KafkaServer.startup(KafkaServer.scala:252)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
at kafka.Kafka$.main(Kafka.scala:82)
at kafka.Kafka.main(Kafka.scala)
[2022-02-17 16:13:40,742] INFO shutting down (kafka.server.KafkaServer)
[2022-02-17 16:13:40,744] INFO [feature-zk-node-event-process-thread]: Shutting down (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2022-02-17 16:13:40,744] INFO [feature-zk-node-event-process-thread]: Stopped (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2022-02-17 16:13:40,745] INFO [feature-zk-node-event-process-thread]: Shutdown completed (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2022-02-17 16:13:40,746] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2022-02-17 16:13:40,850] INFO Session: 0x103d8f7a5700002 closed (org.apache.zookeeper.ZooKeeper)
[2022-02-17 16:13:40,850] INFO EventThread shut down for session: 0x103d8f7a5700002 (org.apache.zookeeper.ClientCnxn)
[2022-02-17 16:13:40,852] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2022-02-17 16:13:40,855] INFO App info kafka.server for 1 unregistered (org.apache.kafka.common.utils.AppInfoParser)
[2022-02-17 16:13:40,855] INFO shut down completed (kafka.server.KafkaServer)
[2022-02-17 16:13:40,856] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2022-02-17 16:13:40,857] INFO shutting down (kafka.server.KafkaServer)
解决办法:修改kafka数据文件目录中的meta.properties文件。
/mnt/tmp/kafka-logs,具体文件路径看自己的kafka系统配置。
删除此行数据,再次启动kafka,即可重启成功。