1

I have copied a working docker/kafka-environment from my local Ubuntu machine to a Google cloud VM. Stuff so far behaves the same - as expected - but on GCP this command

docker run --net=confluent --rm confluentinc/cp-kafka:4.1.0 kafka-topics --list --zookeeper zookeeper:2181

leaves me with this:

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

returns

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)

so zookeeper is running on GCP. Any hint on what is causing this would be much appreciated

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • A couple of things to check. First, your Docker container (client?) complains it's unable to resolve a (DNS) name `zookeeper`. I assume it is looking for a host called `zookeeper`. If so, can you ping `zookeeper` from the client instance? If not, that's one problem. Second, by default you have a liberal, internal firewall rule that permits TCP and UDP (on all ports) and ICMP. If the project's firewall rules have been changed (or, less probably Zookeeper requires something else), you'll need to revise the rules. – DazWilkin Aug 31 '18 at 15:08
  • 1
    It's tough for us do troubleshoot zookeeper problems when you leave out the part where you started zookeeper. Maybe you should start at the beginning? – CantankerousBullMoose Aug 31 '18 at 18:02
  • Thanks DazWilkin - turns out the problem is not a missing host but for some reason a docker container named zookeeper was not up and running. – EggInMyFace Aug 31 '18 at 21:05
  • Ideally you wouldn't run both services on one machine anyway – OneCricketeer Aug 31 '18 at 23:49

1 Answers1

0

Turns out the docker container "zookeeper" was not available which caused the UnknownHostException. Not the most clever way to name docker containers...