启动kafka报错ERROR Fatal error during KafkaServer startup. Prepare to shutdown ,找到原因就要可以解决

一、错误

报的错:
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)

二、错误原因

meta.properties(路径:/opt/kafka/logs)里面的id值和/opt/kafka/configserver.properties中的broker.id不一致。

起因是这样的:由于误删除了linux上的文件,以至于cd这样的命令都无法使用,幸亏还有其他的节点可以使用,经过一番倒腾后,成功的运行了zookeeper,然而运行kafka的时候,报错了ERROR Fatal error during KafkaServer startup. Prepare to shutdown ,错误提示如下的第一行。

这里插入图片描述
究其原因,是meta.properties(路径:/opt/kafka/logs)里面的id值和/opt/kafka/configserver.properties中的broker.id不一致。
启动kafka报错ERROR Fatal error during KafkaServer startup. Prepare to shutdown ,找到原因就要可以解决_第1张图片这是我修改之后,原本是broker.id=1

三、系统提示

[2022-06-18 14:32:02,309] 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)
[2022-06-18 14:32:02,323] INFO shutting down (kafka.server.KafkaServer)
[2022-06-18 14:32:02,354] INFO [feature-zk-node-event-process-thread]: Shutting down (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2022-06-18 14:32:02,360] INFO [feature-zk-node-event-process-thread]: Stopped (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2022-06-18 14:32:02,383] INFO [feature-zk-node-event-process-thread]: Shutdown completed (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2022-06-18 14:32:02,406] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2022-06-18 14:32:02,568] INFO Session: 0x1000059c2cd0000 closed (org.apache.zookeeper.ZooKeeper)
[2022-06-18 14:32:02,583] INFO EventThread shut down for session: 0x1000059c2cd0000 (org.apache.zookeeper.ClientCnxn)
[2022-06-18 14:32:02,588] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2022-06-18 14:32:02,621] INFO App info kafka.server for 0 unregistered (org.apache.kafka.common.utils.AppInfoParser)
[2022-06-18 14:32:02,624] INFO shut down completed (kafka.server.KafkaServer)
[2022-06-18 14:32:02,625] ERROR Exiting Kafka. (kafka.Kafka$)
[2022-06-18 14:32:02,655] INFO shutting down (kafka.server.KafkaServer)

四、解决办法

找到了原因,把broker=0和broker.id=1修改为一样的值,然后重启动,ERROR Fatal error during KafkaServer startup. Prepare to shutdown 的错误就没了。

你可能感兴趣的:(Linux,hadoop,kafka,scala,linux)