我正在尝试连接到amazon管理的流kafka群集。我一直在遵循关于创建主题的教程https://docs.aws.amazon.com/msk/latest/developerguide/create-topic.html.
我的vpc安全组允许任何入站和出站流量,所以我不怀疑这会阻止连接。
我试过这个命令。
bin/kafka-topics.sh --create --zookeeper ZookeeperConnectString --replication-factor 3 --partitions 1 --topic AWSKafkaTutorialTopic
会产生令人不快的错误:
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: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.admin.TopicCommand$ZookeeperTopicService$.apply(TopicCommand.scala:262)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:53)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
我做错了什么?需要什么配置来防止连接超时?
1条答案
按热度按时间nlejzf6q1#
我也犯了同样的错误。一旦您的群集处于活动状态,请转到msk服务并检查群集的安全组。然后您必须在该安全组中添加入站规则,以允许来自您的客户机的安全组的所有通信。
这是本教程的最后一点:
https://docs.aws.amazon.com/msk/latest/developerguide/create-client-machine.html