kafka 集群搭建時遇到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

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

我的原因

server.properties 配置文件中zookeeper.connect=ip:port

需要改成域名方式,同時修改系統的hosts文件

例如 zookeeper.connect=zk1:2181


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM