Search code examples
dockeramazon-ec2apache-storm

Incorrect Nimbus host resolution


I am running Apache Storm Nimbus and Supervisor inside separate docker containers, using https://hub.docker.com/_/storm/. The containers are running on the same AWS EC2 instance. The command I am using to start the Nimbus Container is

docker run -p 6627:6627 --hostname <ec2_public_ip> -d --restart always --name nimbus storm storm nimbus -c storm.zookeeper.servers='[<zookeeper_hosts>]'

The command I am using to start the Supervisor Container is

docker run -p 6700:6700 --hostname <ec2_public_ip> -d --restart always --name supervisor storm storm supervisor -c storm.zookeeper.servers='[<zookeeper_hosts>]' -c nimbus.seeds='[<ec2_public_ip>]'

All the ports are open in the security group and the zookeeper instances are up and running.

When I try to deploy a topology from my local box using

storm jar topology.jar topologyClass

Storm initially uses the correct public ip address and logs

2037 [main] INFO  o.a.s.u.NimbusClient - Found leader nimbus : ip-<private_ip_address>.us-west-1.compute.internal:6627

However, you can see that in the above log the private ip address is returns, to which storm is not able to connect.

Caused by: java.lang.RuntimeException: org.apache.storm.thrift.transport.TTransportException: java.net.UnknownHostException: ip-<private_ip_address>.us-west-1.compute.internal

Can someone please point out what would be the approach for the public ip address to be sent back to Storm from inside the docker container instead of the private ip address?


Solution

  • Nimbus figures out its hostname/port in https://github.com/apache/storm/blob/e909b3d604367e7c47c3bbf3ec8e7f6b672ff778/storm-client/src/jvm/org/apache/storm/nimbus/NimbusInfo.java#L56

    As you can see, you should set storm.local.hostname in your storm.yaml.