线程"main" kafka.zookeeper.ZooKeeperClientTimeoutException:在等待连接时超时,处于状态:正在连接



我在这里重申这个问题- "kafka.zookeeper。ZooKeeperClientTimeoutException:超时等待连接"仅在列出主题期间。

C:SoftwaresElastic_Kafkakafkabinwindows>kafka-topics.bat --zookeeper localhost:9092 --alter --topic quickstart-events --partitions 5
[2021-03-03 19:52:20,897] WARN Client session timed out, have not heard from server in 30001ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
Exception in thread "main" kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
at kafka.zookeeper.ZooKeeperClient.$anonfun$waitUntilConnected$3(ZooKeeperClient.scala:262)
at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:258)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:119)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1865)
at kafka.admin.TopicCommand$ZookeeperTopicService$.apply(TopicCommand.scala:360)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:55)
at kafka.admin.TopicCommand.main(TopicCommand.scala)

这是我的错误:

C:SoftwaresElastic_Kafkakafkabinwindows>kafka-topics.bat --create --topic quickstart-events --bootstrap-server localhost:9092
Created topic quickstart-events.
C:SoftwaresElastic_Kafkakafkabinwindows>kafka-topics.bat --zookeeper localhost:9092 --alter --topic quickstart-events --partitions 5
[2021-03-03 19:52:20,897] WARN Client session timed out, have not heard from server in 30001ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
Exception in thread "main" kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
at kafka.zookeeper.ZooKeeperClient.$anonfun$waitUntilConnected$3(ZooKeeperClient.scala:262)
at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:258)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:119)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1865)
at kafka.admin.TopicCommand$ZookeeperTopicService$.apply(TopicCommand.scala:360)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:55)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
C:SoftwaresElastic_Kafkakafkabinwindows>

您连接到错误的端口,或滥用参数,Zookeeper没有在端口9092上运行,您应该使用--bootstrap-server而不是--zookeeper

最新更新