Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there precautions that one should take when a Cassandra Docker container changes IP?

I often observe that container IPs change during run time, hence I was wondering if these occurrences have any consequences especially when it comes to Cassandra containers in a cluster.

Are there any precautions to consider or does Docker resolve everything?

For example, is it possible for a container cluster node to be seen as a dead node due to a container IP change? Without Docker we can tackle dead node replacement with the -Dcassandra.replace_address option to specify that old_ip is now new_ip, do I need to do the same with Docker?

Thank you for your time

like image 718
João Matos Avatar asked Jan 04 '18 15:01

João Matos


People also ask

Do Docker container IP addresses change?

Using a container ip, instead of it's container/service name or network alias, is a call for trouble. While the names/alisas remain stable, the ip might change with the restart of a container.

Do Docker containers have different IP addresses?

By default, the container is assigned an IP address for every Docker network it connects to. The IP address is assigned from the pool assigned to the network, so the Docker daemon effectively acts as a DHCP server for each container.

Does Docker use IP forwarding?

Docker relies on the host being capable of performing certain functions to make Docker networking work. Namely, your Linux host must be configured to allow IP forwarding.


1 Answers

If you are running Cassandra in a container then with the sufficient port mappings you should be fine for that one container. However, other Cassandra nodes should be made aware of the IP change of the container.

The CASSANDRA_BROADCAST_ADDRESS is meant for this. It specifies which IP address to advertise to other nodes. You can supply this as an environment variable when you are starting your container.

like image 191
Atakan E. Avatar answered Oct 10 '22 05:10

Atakan E.