我对 Apache Kafka 有一个不可预测的重大问题。我正在使用 Kafka 0.8,运行几个小时后它开始丢弃我的应用程序。特别是制作人。
这种行为是不可预测的,我无法始终如一地重现它。
- 我的操作系统是 Mac 操作系统
- 我正在使用 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)
我究竟做错了什么?