Change the datacenter set in cassandra-rackdc on Ubuntu

Problem: Changing just the datacenter name in 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.

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/
# 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.

Kj [/.] Sreekumar programs computers as a hobby and profession. Into programming from his school days, Sree uses Codemarvels to key in facts and fixes he finds interesting while working on different projects. Some of the articles here give away a few shades of his philosophical leanings too.

Leave a Comment

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