Kafka startup crash (ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaSer)

created at 11-24-2021 views: 10

implement:

nohup bin/kafka-server-start.sh config/server.properties &

Enter the log:

cd /export/servers/kafka_2.12-2.4.1/logs
cat server.log

View the error message:

[2021-11-24 14:19:31,577] INFO [ZooKeeperClient Kafka server] Connected. (kafka.zookeeper.ZooKeeperClient)
[2021-11-24 14:19:31,850] INFO Cluster ID = F5_E0Y5hRaaG9s_xgm5qpg (kafka.server.KafkaServer)
[2021-11-24 14:19:31,874] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentClusterIdException: The Cluster ID F5_E0Y5hRaaG9s_xgm5qpg doesn't match stored clusterId Some(i6qZt03xSSy1SyP0jGCYDw) 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:220)
        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
        at kafka.Kafka$.main(Kafka.scala:84)
        at kafka.Kafka.main(Kafka.scala)
[2021-11-24 14:19:31,876] INFO shutting down (kafka.server.KafkaServer)
[2021-11-24 14:19:31,879] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2021-11-24 14:19:31,985] INFO Session: 0x10000024a760003 closed (org.apache.zookeeper.ZooKeeper)
[2021-11-24 14:19:31,985] INFO EventThread shut down for session: 0x10000024a760003 (org.apache.zookeeper.ClientCnxn)
[2021-11-24 14:19:31,987] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2021-11-24 14:19:31,990] INFO shut down completed (kafka.server.KafkaServer)
[2021-11-24 14:19:31,990] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2021-11-24 14:19:31,994] INFO shutting down (kafka.server.KafkaServer)

It is found that the clusterId does not match

Solution 1

1 Enter config

cd /export/servers/kafka_2.12-2.4.1/config

2 cat server.properties found the configuration item of log.dirs, mine is

log.dirs=/export/servers/kafka_2.12-2.4.1/data

3 Enter data and modify the meta.properties file

Change cluster.id= to the value of Cluster ID, Mine is: F5_E0Y5hRaaG9s_xgm5qpg

solution 2

According to the configuration item of log.dirs=/export/servers/kafka_2.12-2.4.1/data, enter the data/ folder
cd /export/servers/kafka_2.12-2.4.1/data
Delete all files and folders, and execute again: nohup bin/kafka-server-start.sh config/server.properties &

created at:11-24-2021
edited at: 11-24-2021: