kafka startup ERROR: Fatal error during KafkaServer startup. Prepare to shutdown

created at 06-19-2022 views: 52

error

ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentBrokerIdException: Configured broker.id 0 doesn’t match stored broker.id Some(1) 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.getOrGenerateBrokerId(KafkaServer.scala:793)
at kafka.server.KafkaServer.startup(KafkaServer.scala:221)
at kafka.Kafka$.main(Kafka.scala:109)
at kafka.Kafka.main(Kafka.scala)

reason

The id value in meta.properties (path: /opt/kafka/logs) is inconsistent with the broker.id in server.properties of /opt/kafka/config.

The reason is this: because the files on linux were deleted by mistake, commands such as cd cannot be used. Fortunately, there are other nodes that can be used. After a lot of ups and downs, zookeeper was successfully run, but kafka was run. When the error is reported ERROR Fatal error during KafkaServer startup. Prepare to shutdown, the error prompts the first line as follows.

[root@localhost logs] cat meta.properties
#
cluster.id=xxxxxxxxxxxxx
version=0
broker,id=0

broker.id

This is after my modification, it was originally broker.id=1

solution

Find the reason, change broker=0 and broker.id=1 to the same value, then restart, the error of ERROR Fatal error during KafkaServer startup. Prepare to shutdown is gone.

created at:06-19-2022
edited at: 06-19-2022: