This is a quick and dirty opinionated guide to setting up a Cassandra cluster with multiple data centers.
endpoint_snitch: GossipingPropertyFileSnitch
, some prefer PropertyFileSnitch for the ease of pushing out one file. GossipingPropertyFileSnitch is harder to get wrong in my experience.system_auth
keyspace to use NetworkTopologyStrategy in cqlsh with RF 3 (or == number of replicas if less than 3 per dc) for each datacenter you’ve created ALTER KEYSPACE system_auth WITH REPLICATION= {'class' : 'NetworkTopologyStrategy', 'data_center_name' : 3, 'data_center_name' : 3};
, run repair after changing RFnodetool repair -pr system_auth
on each node in the cluster on the new keyspace.system_auth
step above).nodetool repair -pr whatever_new_keyspace
on each node in the cluster on the new keyspace.This is harder and involves more work and more options, but I’m going to discuss the way that gets you into the least amount of trouble operationally.
endpoint_snitch
on each node to GossipingPropertyFileSnitchsystem_auth
keyspace to use NetworkTopologyStrategy in cqlsh with RF 3 (or == number of replicas if less than 3 per dc) for each datacenter you’ve created ALTER KEYSPACE system_auth WITH REPLICATION= {'class' : 'NetworkTopologyStrategy', 'data_center_name' : 3, 'data_center_name' : 3};
, run repair after changing RFnodetool repair -pr system_auth
on each node in the cluster on the new keyspace.system_auth
step above),nodetool repair -pr whatever_keyspace
on each node in the cluster on the new keyspace.enjoy new data center
Best done with if your repair jobs can’t be missed or stopped, either because you have a process like OpsCenter or Reaper running repairs. It also has the advantage of being very easy, and if you’ve already automated repair you’re basically done.
Faster less resource intensive, and if you have enough time to complete it while repair is stopped. Rebuild is easier to ‘resume’ than repair in many ways, so this has a number of advantages.
nodetool rebuild
on each node in the new dc only, if it dies for some reason, rerunning the command will resume the process.nodetool cleanup
This will probably over stream it’s share of data and honestly a lot of folks do this for some reason in practice:
nodetool rebuild
on each node in the new dc only, if it dies for some reason, rerunning the command will resume the process.nodetool cleanup
on each nodeThere are a few valid approaches to this and none of them are wrong IMO.
Will need to get into racks and a lot of people get this wrong and imbalance the racks, but you get the advantage of more intelligent failure modes, with racks mapping to AZs.
This allows things to be balanced easily, but you have no good option for racks then. However, some people think racks are overrated, and I’d say a majority of clusters run with one rack.