Kafka超时错误:Timed out waiting for connection while in state

释放双眼,带上耳机,听听看~!

启动Kafka报错如下:
“ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING”

启动Kafka

/opt/application/kafka_2.12-2.2.1/bin/kafka-server-start.sh /opt/application/kafka_2.12-2.2.1/config/server.properties
[2019-07-08 10:28:38,873] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
        at kafka.zookeeper.ZooKeeperClient.$anonfun$waitUntilConnected$3(ZooKeeperClient.scala:242)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:251)
        at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:238)
        at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:96)
        at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1825)
        at kafka.server.KafkaServer.createZkClient$1(KafkaServer.scala:361)
        at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:385)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:205)
        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
        at kafka.Kafka$.main(Kafka.scala:75)
        at kafka.Kafka.main(Kafka.scala)
[2019-07-08 10:28:38,878] INFO shutting down (kafka.server.KafkaServer)
[2019-07-08 10:28:38,890] INFO shut down completed (kafka.server.KafkaServer)
[2019-07-08 10:28:38,891] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2019-07-08 10:28:38,896] INFO shutting down (kafka.server.KafkaServer)

错误复现

分析原因

1)测试是否能和集群中的其它zooKeeper节点端口通讯
2)测试是否能和集群中的其它节点Kafka端口通讯
3)查看防火墙配置,如果配置不好iptables,建议关闭
4)关闭SELINUX
5)查看/etc/hosts中有无其它绑定地址,如果有影响,建议临时注释后再启动查看
6)查看/etc/resolv.conf中的DNS配置

我的原因

我的原因是因为/etc/resolv.conf中添加了其它的DNS地址,所以导致在Kafka启动时无法解析到集群中的其它节点,我把以下节点注释以后,启动成功

cat /etc/resolv.conf 
; generated by /usr/sbin/dhclient-script
#search openstacklocal novalocal
#nameserver 114.114.114.114
#nameserver 10.151.128.4
#nameserver 10.151.128.3
#nameserver 10.151.128.2

人已赞赏
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧