Zookeeper f-sync问题导致Kafka超时

时间:2017-03-08 14:37:34

标签: apache-kafka apache-zookeeper

我们正尝试在具有16个核心的VM上进行单节点安装。 Zookeeper& amp; 16 GB RAM卡夫卡。 Zookeeper显示f-sync问题,在设置超时时间为6000ms后,kafka会给出超时。

其他信息: Zookeeper版本:3.4.6-1569965 卡夫卡版本:2.11-0.9.0.1

以下条目存在于ZK日志中:

[2017-03-06 16:37:18,013] INFO Processed session termination for sessionid: 0x15aa58d60530000 (org.apache.zookeeper.server.PrepRequestProcessor)
[2017-03-06 16:37:45,308] WARN fsync-ing the write ahead log in SyncThread:0 took 35773ms which will adversely effect operation latency. See the ZooKeeper troubleshooting guide (org.apache.zookeeper.server.persistence.FileTxnLog)
[2017-03-06 16:37:45,334] INFO Established session 0x15aa58d60530000 with negotiated timeout 6000 for client /127.0.0.1:44860 (org.apache.zookeeper.server.ZooKeeperServer)
[2017-03-06 16:37:45,340] WARN caught end of stream exception (org.apache.zookeeper.server.NIOServerCnxn)
EndOfStreamException: Unable to read additional data from client sessionid 0x15aa58d60530000, likely client has closed socket
        at org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:228)
        at org.apache.zookeeper.server.NIOServerCnxnFactory.run(NIOServerCnxnFactory.java:208)
        at java.lang.Thread.run(Thread.java:745)
[2017-03-06 16:37:45,347] INFO Closed socket connection for client /127.0.0.1:44860 which had sessionid 0x15aa58d60530000 (org.apache.zookeeper.server.NIOServerCnxn)
[2017-03-06 16:37:50,360] WARN fsync-ing the write ahead log in SyncThread:0 took 5009ms which will adversely effect operation latency. See the ZooKeeper troubleshooting guide (org.apache.zookeeper.server.persistence.FileTxnLog)

Kafka对ZK错误超时:

[2017-03-06 16:10:11,115] FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000
                at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1223)
                at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:155)
                at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:129)
                at kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:89)
                at kafka.utils.ZkUtils$.apply(ZkUtils.scala:71)
                at kafka.server.KafkaServer.initZk(KafkaServer.scala:278)
                at kafka.server.KafkaServer.startup(KafkaServer.scala:168)
                at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)
                at kafka.Kafka$.main(Kafka.scala:67)
                at kafka.Kafka.main(Kafka.scala)
[2017-03-06 16:10:11,120] INFO shutting down (kafka.server.KafkaServer)
[2017-03-06 16:10:11,128] INFO shut down completed (kafka.server.KafkaServer)
[2017-03-06 16:10:11,129] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable)
org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000
                at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1223)
                at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:155)
                at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:129)
                at kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:89)
                at kafka.utils.ZkUtils$.apply(ZkUtils.scala:71)
                at kafka.server.KafkaServer.initZk(KafkaServer.scala:278)
                at kafka.server.KafkaServer.startup(KafkaServer.scala:168)
                at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)
                at kafka.Kafka$.main(Kafka.scala:67)
                at kafka.Kafka.main(Kafka.scala)
[2017-03-06 16:10:11,140] INFO shutting down (kafka.server.KafkaServer)

如果已知任何可用的解决方法问题,请分享我可以跟进的所有链接/论坛。

由于

1 个答案:

答案 0 :(得分:0)

检查您的zookeeper是否正在运行

您已在配置中提供了正确的端口

对于消费者使用zookeeper端口(默认为2181)和生产者使用kafka端口(默认为6667)