Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Cassandra datacenter name

Tags:

cassandra

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.

like image 755
Chris Tatro Avatar asked May 15 '16 11:05

Chris Tatro


1 Answers

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.

like image 130
Bhuvan Rawal Avatar answered Sep 17 '22 10:09

Bhuvan Rawal