Apache Kafka放弃了我的制作人和消费者

时间:2015-05-04 05:21:00

标签: java spring apache-kafka kafka-consumer-api

我对Apache Kafka有一个重大的不可预测的问题。我正在使用Kafka 0.8,经过几个小时的运行后,它开始丢弃我的应用程序。特别是制片人。

行为是不可预测的,我无法一致地重现它。

  • 我的操作系统是Mac OS
  • 我使用的是Java 7(Producer是一个Web应用程序)
  • 我在9092和9093
  • 的同一个盒子上运行了两个主题和两个服务器

我在Zookeeper上看到以下错误

EndOfStreamException: Unable to read additional data from client sessionid 0x14d1b94a22d001b, 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)
[2015-05-03 20:35:37,988] INFO Closed socket connection for client /0:0:0:0:0:0:0:1:60236 which had sessionid 0x14d1b94a22d001b (org.apache.zookeeper.server.NIOServerCnxn)
[2015-05-03 20:35:37,989] INFO Closed socket connection for client /127.0.0.1:60204 which had sessionid 0x14d1b94a22d0016 (org.apache.zookeeper.server.NIOServerCnxn)
[2015-05-03 20:35:37,989] WARN Ignoring unexpected runtime exception (org.apache.zookeeper.server.NIOServerCnxnFactory)
java.nio.channels.CancelledKeyException
    at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:73)
    at sun.nio.ch.SelectionKeyImpl.readyOps(SelectionKeyImpl.java:87)
    at org.apache.zookeeper.server.NIOServerCnxnFactory.run(NIOServerCnxnFactory.java:187)
    at java.lang.Thread.run(Thread.java:745)

这是我在9093服务器上看到的错误

java.lang.IllegalStateException: Kafka scheduler has not been started
    at kafka.utils.KafkaScheduler.ensureStarted(KafkaScheduler.scala:114)
    at kafka.utils.KafkaScheduler.shutdown(KafkaScheduler.scala:86)
    at kafka.controller.KafkaController.onControllerResignation(KafkaController.scala:350)
    at kafka.controller.KafkaController$SessionExpirationListener$$anonfun$handleNewSession$1.apply$mcZ$sp(KafkaController.scala:1108)
    at kafka.controller.KafkaController$SessionExpirationListener$$anonfun$handleNewSession$1.apply(KafkaController.scala:1107)
    at kafka.controller.KafkaController$SessionExpirationListener$$anonfun$handleNewSession$1.apply(KafkaController.scala:1107)
    at kafka.utils.Utils$.inLock(Utils.scala:535)
    at kafka.controller.KafkaController$SessionExpirationListener.handleNewSession(KafkaController.scala:1107)
    at org.I0Itec.zkclient.ZkClient$4.run(ZkClient.java:472)
    at org.I0Itec.zkclient.ZkEventThread.run(ZkEventThread.java:71)

我做错了什么?

1 个答案:

答案 0 :(得分:0)

日志表明zookeeper暂时断开连接,增加了zookeeper超时值