Reputation: 113
Is it possible to change the datacenter name in a Cassandra Cluster? If so how do I accomplish this? I have a Dev cluster which was built with the default DC name 'Cassandra'. I would like to change this because we are going to be setting up and testing replication between DCs.
Upvotes: 9
Views: 12564
Reputation: 406
Its possible you can change the snitch to GossipingFilePropertySnitch and specify the dc name and rack name in cassandra-rackdc.properties
file, After doing that you need to restart the node, in that case you will get an error like :
Error: Cannot start node if snitch's data center (<new-datacentername>) differs from previous data center (<old-datacenter-name>).
Please fix the snitch configuration, decommission and rebootstrap this node or use the flag -Dcassandra.ignore_dc=true.
In order to avoid this need to add the below line in cassandra-env.sh
file and restart the node.
JVM_OPTS=\"$JVM_OPTS -Dcassandra.ignore_rack=true -Dcassandra.ignore_dc=true\"'
Remember, you will need downtime for your cluster to restart your datacenter in this case if doing this on production environment.
Upvotes: 11