连接kafka消息队列报org.apache.kafka.clients.NetworkClient异常

启动kafka后,连接kafka消息队列报org.apache.kafka.clients.NetworkClient异常

复制代码
could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

检查kafka运行日志,报The broker is trying to join the wrong cluster异常

复制代码
[2024-11-06 16:31:11,219] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentClusterIdException: The Cluster ID QAy4XKSVSYWyIWRKCl3BBQ doesn't match stored clusterId Some(AMdXxjsGTe-ebuBwX0E57g) 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:252)
	at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
	at kafka.Kafka$.main(Kafka.scala:82)
	at kafka.Kafka.main(Kafka.scala)
[2024-11-06 16:31:11,221] INFO shutting down (kafka.server.KafkaServer)
[2024-11-06 16:31:11,223] INFO [feature-zk-node-event-process-thread]: Shutting down (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2024-11-06 16:31:11,224] INFO [feature-zk-node-event-process-thread]: Shutdown completed (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2024-11-06 16:31:11,224] INFO [feature-zk-node-event-process-thread]: Stopped (kafka.server.FinalizedFeatureChangeListener$ChangeNotificationProcessorThread)
[2024-11-06 16:31:11,225] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2024-11-06 16:31:11,329] INFO Session: 0x110085d708f0001 closed (org.apache.zookeeper.ZooKeeper)
[2024-11-06 16:31:11,329] INFO EventThread shut down for session: 0x110085d708f0001 (org.apache.zookeeper.ClientCnxn)
[2024-11-06 16:31:11,331] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2024-11-06 16:31:11,335] INFO App info kafka.server for 0 unregistered (org.apache.kafka.common.utils.AppInfoParser)
[2024-11-06 16:31:11,336] INFO shut down completed (kafka.server.KafkaServer)
[2024-11-06 16:31:11,337] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2024-11-06 16:31:11,337] INFO shutting down (kafka.server.KafkaServer)

修改kafka日志目录的meta.properties文件的cluster.id值

复制代码
cluster.id=AMdXxjsGTe-ebuBwX0E57g
version=0
broker.id=0

最后再重启kafka,连接恢复正常

相关推荐
清风198137 分钟前
kafka消息可靠性传输语义
数据库·分布式·kafka
小诸葛的博客40 分钟前
Kafka、RocketMQ、Pulsar对比
分布式·kafka·rocketmq
IT成长日记1 天前
【Kafka基础】Kafka工作原理解析
分布式·kafka
州周1 天前
kafka副本同步时HW和LEO
分布式·kafka
程序媛学姐1 天前
SpringKafka错误处理:重试机制与死信队列
java·开发语言·spring·kafka
小马爱打代码2 天前
Kafka - 消息零丢失实战
分布式·kafka
长河2 天前
Kafka系列教程 - Kafka 运维 -8
运维·分布式·kafka
Vic23342 天前
Kafka简要介绍与快速入门示例
分布式·kafka
老友@3 天前
Kafka 全面解析
服务器·分布式·后端·kafka
半间烟雨3 天前
⼆、Kafka客户端消息流转流程
分布式·kafka