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
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With