Intra-job DNS resolution

Hi there,

I’m currently trying to run Zookeeper as a nomad job, but this question could really apply to any similar clustered service.

Each zookeeper node needs to know the IP address of each other zookeeper node. I can do a variety of things in my nomad file to launch 3 separate zookeeper instances, but none of them seem to be able to get the ip address of the other 2.

I could create a zookeeper task in a task group with a count of 3, but I don’t see any way of informing each instance of the other 2’s IP address.

I could place a separate task for each zookeeper node in a group and get env variables for the other 2 tasks, but then nomad will want to place the zookeeper nodes on the same client, which is the opposite of what I’d want for high availability.

I could also create tasks in their own groups and then assign a differently named service for each port, but that seems unnecessary.

I believe I’m having a similar dilemma. In an attempt to keep the code clean I’m using a single resource block to create three zookeeper servers. I have the same requirement to acquire the IP address of each server in order to configure the the three.