最近一段时间发现kafka集群无法启动或无法正常工作,以下是一些报错日志信息,这些信息来源不同日期。
(1) ERROR Error while creating ephemeral at /brokers/ids/0, node already exists and owner '72067757872119809' does not match current session '72067836689711106' (kafka.zk.KafkaZkClient$CheckedEphemeral) 2021-05-05 02:19:44.796 [INF] [Kafka] [2021-05-05 02:19:44,786] ERROR [KafkaServer id=0] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
(2) [2023-08-22 10:09:08,204] WARN [Consumer clientId=consumer-console-consumer-27062-1, groupId=console-consumer-27062] 1 partitions have leader brokers without a matching listener, including [test-topic1-0] (org.apache.kafka.clients.NetworkClient)
(3) WARN [QuorumConnectionThread-[myid=3]-3:QuorumCnxManager@400] - Cannot open channel to 2 at election address zk2/10.67.28.219:3555 java.net.ConnectException: Connection refused (Connection refused)
(4) [2023-08-22 03:26:09,911] WARN [Producer clientId=console-producer] Bootstrap broker 192.168.30.60:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
(5) Session 0x0 for sever k8snode-76/192.168.30.76:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.EndOfStreamException: Unable to read additional data from server sessionid 0x0, likely server has closed socket
(6) ERROR [ReplicaFetcher replicaId=2, leaderId=3, fetcherId=0] Error for partition config_2592-1 at offset 0 (kafka.server.ReplicaFetcherThread)
请问下这些日志产生的原因一般有哪些?谢谢
该错误表示broker已经在
id=0
的情况下运行,或者 Zookeeper 已损坏,因为broker之前没有正常关闭。在后一种情况下,可以尝试使用
Zookeeper-shell
来rmr /brokers/ids/0
,但是,这可能会比重新启动 Zookeeper 和 kafka broker 产生更多意想不到的后果。推荐重启 Zookeeper 和 kafka broker可恢复。
重启 zookeeper 和 kafka broker 就解决了这个问题。如果你使用的是 docker-compose,可以这么重启:
对于k8s部署重启kafka和zookeeper会有时序性问题吧
先重启zk,在重启kafka。
k8s 重启顺序不确定
都这样了,你可以先全部停止掉,在启动呀。
还有如果kafka先于zookeeper重启,需要将所有kafka进程杀掉么
你的答案