报错如下:

[2023-03-07 22:02:28,799] INFO Cluster ID = xRL5n-bcSd6T-eKzuREzEQ (kafka.server.KafkaServer)
[2023-03-07 22:02:28,834] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentBrokerIdException: Configured broker.id 1 doesn't match stored broker.id 0 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:762)
	at kafka.server.KafkaServer.startup(KafkaServer.scala:223)
	at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
	at kafka.Kafka$.main(Kafka.scala:84)
	at kafka.Kafka.main(Kafka.scala)
[2023-03-07 22:02:28,842] INFO shutting down (kafka.server.KafkaServer)
[2023-03-07 22:02:28,862] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2023-03-07 22:02:28,971] INFO Session: 0x3000e4b39d70004 closed (org.apache.zookeeper.ZooKeeper)
[2023-03-07 22:02:28,971] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2023-03-07 22:02:28,982] INFO EventThread shut down for session: 0x3000e4b39d70004 (org.apache.zookeeper.ClientCnxn)
[2023-03-07 22:02:28,991] INFO shut down completed (kafka.server.KafkaServer)
[2023-03-07 22:02:28,993] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2023-03-07 22:02:29,038] INFO shutting down (kafka.server.KafkaServer)

解决方式很明了,报错信息中指出

Configured broker.id 1 doesn't match stored broker.id 0 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).

简单说就是,broker.id对不上,把日志文件(log.dirs上设置的路径)删了后,重新尝试启动就好

kafka-server-start.sh -daemon ./config/server.properties 

jps查看进程

轻松秒杀

Logo

大数据从业者之家,一起探索大数据的无限可能!

更多推荐