Switching snitches

Steps for switching snitches.

Because snitches determine how the database distributes replicas, the procedure to switch snitches depends on whether the topology of the cluster changes:

  • 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.

A change in topology means that there is a change in the datacenters and/or racks where the nodes are placed. Topology changes may occur when the replicas are placed in different places by the new snitch. Specifically, the replication strategy places the replicas based on the information provided by the new snitch. The following examples demonstrate the differences:

cassandra.yaml

The location of the cassandra.yaml file depends on the type of installation:

Package installations
Installer-Services installations

/etc/dse/cassandra/cassandra.yaml

Tarball installations
Installer-No Services installations

installation_location/resources/cassandra/conf/cassandra.yaml

cassandra-rackdc.properties

The location of the cassandra-rackdc.properties file depends on the type of installation:

Package installations
Installer-Services installations

/etc/dse/cassandra/cassandra-rackdc.properties

Tarball installations
Installer-No Services installations

installation_location/resources/cassandra/conf/cassandra-rackdc.properties

cassandra-topology.properties

The location of the cassandra-topology.properties file depends on the type of installation:

Package installations
Installer-Services installations

/etc/dse/cassandra/cassandra-topology.properties

Tarball installations
Installer-No Services installations

installation_location/resources/cassandra/conf/cassandra-topology.properties

Procedure

  1. Create a properties file with datacenter and rack information.
  2. Copy the cassandra-rackdc.properties or cassandra-topology.properties file to the configuration directory on all the cluster's nodes. They won't be used until the new snitch is enabled.
  3. Change the snitch for each node in the cluster in the node's cassandra.yaml file. For example:
    endpoint_snitch: GossipingPropertyFileSnitch
  4. 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.

  5. If the topology of the network has changed, but no datacenters are added:
    1. Shut down all the nodes, then restart them.
    2. Run a sequential repair and nodetool cleanup on each node.
  6. If the topology of the network has changed and a datacenter is added:
    1. Create a new datacenter.
    2. Replicate data into new datacenter. Remove nodes from old datacenter.
    3. Run a sequential repair and nodetool cleanup on each node.
      Important: DataStax recommends stopping repair operations during topology changes; the Repair Service does this automatically. Repairs running during a topology change are likely to error when it involves moving ranges.
  7. If migrating from the PropertyFileSnitch to the GossipingPropertyFileSnitch, remove the cassandra-topology.properties file from each node on any new cluster after the migration is complete.