Cassandra replication factor when have multiple data centres

When using the NetworkTopologyStrategy, you specify your replication factor on a per-data-center basis using strategy_options:{data-center-name}={rep-factor-value} rather than the global strategy_options:replication_factor={rep-factor-value}.

Here's a concrete example adapted from http://www.datastax.com/docs/1.0/references/cql/CREATE_KEYSPACE

CREATE KEYSPACE Excalibur WITH strategy_class = 'NetworkTopologyStrategy'
  AND strategy_options:DC1 = 2 AND strategy_options:DC2 = 2;

In that example, any given column would be stored on 4 nodes total, with 2 in each data center.


Replication factor is basically number of replicas( additional copies ) you want to have.

One thing to remember is its always stated " Number of replicas should not be more than number of nodes". So i you have 2 nodes you are not supposed to have 3 as replication factor.

Tags:

Cassandra