CQL for Cassandra 2.x

Updating the replication factor

Increasing the replication factor increases the total number of copies of keyspace data stored in a Cassandra cluster. If you are using security features, it is particularly important to increase the replication factor of the system_auth keyspace from the default (1) because you will not be able to log into the cluster if the node with the lone replica goes down. It is recommended to set the replication factor for the system_auth keyspace equal to the number of nodes in each data center.

Procedure

  1. Update a keyspace in the cluster and change its replication strategy options.
    ALTER KEYSPACE system_auth WITH REPLICATION =
      {'class' : 'NetworkTopologyStrategy', 'dc1' : 3, 'dc2' : 2};

    Or if using SimpleStrategy:

    ALTER KEYSPACE "Excalibur" WITH REPLICATION =
      { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };
  2. On each affected node, run the nodetool repair command.
  3. Wait until repair completes on a node, then move to the next node.
Show/hide