Switching snitches
Steps for switching snitches.
- If data has not been inserted into the cluster, there is no change in the network topology. This means that you only need to set the snitch; no other steps are necessary.
- If data has been inserted into the cluster, it's possible that the topology has changed and you will need to perform additional steps.
- No topology change
Suppose you have 5 nodes using the SimpleSnitch in a single datacenter and you change to 5 nodes in 1 datacenter and 1 rack using a network snitch such as the GossipingPropertyFileSnitch.
- Topology changes
- Suppose you have 5 nodes using the SimpleSnitch in a single datacenter and you change to 5 nodes in 2 datacenters using the PropertyFileSnitch.Note: If splitting from one datacenter to two, you need to change the schema for the keyspace that are splitting. Additionally, the datacenter names must change accordingly.
- Changing the name of a datacenter is a topology change.
- Suppose you have 5 nodes using the SimpleSnitch in a single datacenter and you change to 5 nodes in 2 datacenters using the PropertyFileSnitch.
- Topology change
Suppose you have 5 nodes using the SimpleSnitch in a single datacenter and you change to 5 nodes in 1 datacenter and 2 racks using the RackInferringSnitch.
Procedure
-
Create a properties file with datacenter and rack information.
- cassandra-rackdc.properties
GossipingPropertyFileSnitch, Ec2Snitch, and Ec2MultiRegionSnitch only.
- cassandra-topology.properties
All other network snitches.
- cassandra-rackdc.properties
-
Copy the cassandra-rackdc.properties or
cassandra-topology.properties file to the
Cassandra configuration directory on all the cluster's nodes. They won't be used
until the new snitch is enabled.
The location of the cassandra-topology.properties file depends on the type of installation:
Package installations /etc/cassandra/cassandra-topology.properties Tarball installations install_location/conf/cassandra-topology.properties The location of the cassandra-rackdc.properties file depends on the type of installation:Package installations /etc/cassandra/cassandra-rackdc.properties Tarball installations install_location/conf/cassandra-rackdc.properties The location of the cassandra.yaml file depends on the type of installation:Package installations /etc/cassandra/cassandra.yaml Tarball installations install_location/resources/cassandra/conf/cassandra.yaml -
Change the snitch for each node in the cluster in the node's
cassandra.yaml file. For example:
endpoint_snitch: GossipingPropertyFileSnitch
-
If the topology has not changed, you can restart each node one at a time.
Any change in the cassandra.yaml file requires a node restart.
-
If the topology of the network has changed:
- Shut down all the nodes, then restart them.
- Run a sequential repair and nodetool cleanup on each node.