A tiny multi-dc Cassandra cluster with Docker-compose
:tada: Yes, another Docker-Cassandra cluster...
The Docker Image
The docker image is based off abh1nav/cassandra
with changes to support multiple data centers.
Ops Center is currently disabled, but I hope to have time to get that working soon.
Most of the Docker-Casssandra clusters are built with shell scripts that use a combination of
IP-discovery of running containers and environment variables to link containers together.
SkyDock registers the IP for each docker container with SkyDNS using a simple, generated name.
In this cluster, I have the domain configured to be
Docker-compose is a nice way to orchestrate several containers
from a single configuration file. Starting this cluster is as simple as
docker-compose -p cluster up -d
-p cluster speficies the cluster name. This is important since compose will take the directory name by default.
To make the DNS names of the containers perdictable, we specify the name here. This command should start the following:
cluster_seed2_1 cluster_nodedc2_1 cluster_nodedc1_1 cluster_seed1_1 cluster_skydns_1 cluster_skydock_1
This means that the assigned name for the
seed1 service is
cluster_seed1_1.cassandra_compose.dev.docker. If you
cassandra.yaml file, you will see it listed as one of the seed nodes.
docker run -t --rm jdgoldie/cassandra_compose watch -n 3 bin/nodetool -f cluster_seed1_1.cassandra_compose.dev.docker status
to see the status of the cluster. Notice that, thanks to SkyDNS, the hostname resolves to the
Now add some nodes.
docker-compose -p cluster scale nodedc1=2 nodedc2=2
nodetool again and you will see another node join each datacenter.
- Write a full blog entry to expand on
- Get Ops Center working :+1:
- Use labels for datacenters instead of using environment variables.
- Sample application that writes to/from the cluster to demonstrate seamless failover.