The replication factor
Occasionally, there are instances when we come across situations where we make changes to the replication factor. For example, I started with a smaller cluster so I kept my replication factor as 2. Later, I scaled out from 4 nodes to 8 nodes, and thus to make my entire setup more fail-safe, I increased my replication factor to 4. In such situations, the following steps are to be followed:
The following is the command to update the replication factor and/or change the strategy. Execute these commands on the Cassandra CLI:
ALTER KEYSPACEmy_keyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 4 };
Once the command has been updated, you have to execute the
nodetool
repair on each of the nodes one by one (in succession) so that all the keys are correctly replicated as per the new replication values:sudo -bE ./nodetool -h 10.3.12.29 repair my_keyspacemycf -pr 6 mydomain@my-cass3:/home/ubuntu$ sudo -E /usr/local/cassandra/apache-cassandra-1.1...