Change the datacenter set in cassandra-rackdc on Ubuntu

Problem: Changing just the datacenter name in cassandra-rackdc.properties gives the error:

Cannot start node if snitch's data center [newName] differs from previous data center [oldName]. Please fix the snitch configuration, decommission and rebootstrap this node or use the flag -Dcassandra.ignore_dc=true.

Solution:
If you are just beginning to setup you cassandra cluster, and is ok to reset the data to bootstrapped state, do this

sudo service cassandra stop
sudo rm -R /var/lib/cassandra
sudo mkdir /var/lib/cassandra
sudo chown cassandra /var/lib/cassandra
sudo service cassandra start

If you need to persist the existing data, do this

sudo vi /etc/cassandra/cassandra-env.sh
# edit the JVM_OPTS line to make it look like below
JVM_OPTS=\"$JVM_OPTS -Dcassandra.ignore_rack=true -Dcassandra.ignore_dc=true\"

sudo service cassandra restart

This should normally resolve the dc name correction in rack-dc properties file.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *