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. It is particularly important to increase the replication factor of the system_auth keyspace if you are using security features because if you use the default, 1, and the node with the lone replica goes down, you will not be able to log into the cluster because the system_auth keyspace was not replicated.

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