我的Kafka
消费者经常失去与Zookeeper
的连接,但由于连接超时而无法连接。
如何解决问题?
谢谢你。 以下是日志。Exception in thread "main" org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 4000
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.consumer.ZookeeperConsumerConnector.connectZk(ZookeeperConsumerConnector.scala:181)
at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:129)
at kafka.javaapi.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:65)
at kafka.javaapi.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:68)
at kafka.consumer.Consumer$.createJavaConsumerConnector(ConsumerConnector.scala:120)
at kafka.consumer.Consumer.createJavaConsumerConnector(ConsumerConnector.scala)
at com.steelwedge.consumer.JobConsumer.<init>(JobConsumer.java:53)
答案 0 :(得分:1)
你有2个属性。
zookeeper.session.timeout.ms
如果消费者在这段时间内没有心跳到动物园管理员,那么它就会被认为已经死亡并且会发生再平衡
zookeeper.connection.timeout.ms
客户端在建立与zookeeper的连接时等待的最长时间