1. Background
Kafka’s physical machine is unexpectedly down, resulting in Kafka’s failure to start
2. Details of error report
[2022-08-09 08:20:42,097] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentClusterIdException: The Cluster ID 123456 doesn't match stored clusterId Some(456789) 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:235)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
at kafka.Kafka$.main(Kafka.scala:82)
at kafka.Kafka.main(Kafka.scala)
3. Solution
It can be seen that the error is obvious. The cluster-id is not correct. At this time, we can modify the configuration of meta.properties
# The location of the meta.properties file can be found based on the value of the log.dirs parameter in the server.properties configuration file
vim meta.properties
cluster.id=123456
Then it can be started normally