Docker Community Forums

Share and learn in the Docker community.

Swarm 1.12: How to manage swarm clustering when master IP is required?


(Bluepuma77) #1

From the Cassandra Docker hub page:

For separate machines you need to tell Cassandra what IP address to advertise to the other nodes (since the address of the container is behind the docker bridge).

Assuming the first machine’s IP address is 10.42.42.42 and the second’s is 10.43.43.43, start the first with exposed gossip port:

$ docker run --name some-cassandra -d -e CASSANDRA_BROADCAST_ADDRESS=10.42.42.42 -p 7000:7000 cassandra:tag

Then start a Cassandra container on the second machine, with the exposed gossip port and seed pointing to the first machine:

$ docker run --name some-cassandra -d -e CASSANDRA_BROADCAST_ADDRESS=10.43.43.43 -p 7000:7000 -e CASSANDRA_SEEDS=10.42.42.42 cassandra:tag

How can I use Cassandra in a dynamic docker swarm scenario with docker service create?