我已将工作正常的docker / kafka-environment从我的本地Ubuntu计算机复制到了Google Cloud VM。到目前为止,东西的行为与预期相同-但在GCP上,此命令
docker run --net=confluent --rm confluentinc/cp-kafka:4.1.0 kafka-topics --list --zookeeper zookeeper:2181
为此留给我
Exception in thread "main" java.net.UnknownHostException: zookeeper: Name or service not known
at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.zookeeper.client.StaticHostProvider.<init>(StaticHostProvider.java:61)
at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:445)
at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:380)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:86)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1538)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:57)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
telnet localhost 2181 - stats
返回
Zookeeper version: 3.4.8-1--1, built on Fri, 26 Feb 2016 14:51:43 +0100
Clients:
/127.0.0.1:53426[0](queued=0,recved=1,sent=0)
因此zookeeper正在GCP上运行。造成这种情况的任何提示将不胜感激
答案 0 :(得分:0)
结果显示docker容器“ zookeeper”不可用,这导致了UnknownHostException。不是最聪明的命名Docker容器的方式...