CQL for Cassandra 2.0

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, to change a keyspace from using SimpleStrategy to NetworkTopologyStrategy:

    ALTER KEYSPACE mykeyspace WITH REPLICATION =
      { 'class' : 'NetworkTopologyStrategy', 'dc1' : 3 };
  2. On each affected node, run nodetool repair.
  3. Wait until repair completes on a node, then move to the next node.