Advertisement

Latest Post

Sunday, 18 December 2016

2 Best Ways of Cassandra Data Replication [Replication]

Data Replication in Cassandra database
The replication strategy of a keyspace decides which nodes are copies for a given token range. The two main replication strategies are:
  • SimpleStrategy
  • NetworkTopologyStrategy

SimpleStrategy:- SimpleStrategy is used when you have just one data center. The first copy for the data is decided by the partitioner. After that, the placement of the subsequent replicas is determined by the replication strategy in clockwise direction in the Node ring.
For example, if replication_factor is 4, then four different nodes should store a copy of each row.

NetworkTopologyStrategy:- The network topology strategy works well when Cassandra is set the replication factor for each data-center independently. The network topology strategy is data centre and replicas are stored on the different rack. Cassandra uses snitches to discover the overall network overall topology.  This information is used to efficiently route inter-node requests within the bounds of the replica placement strategy.


An operation’s consistency level specifies how many of the replicas need to respond to the coordinator in order to consider the operation a success.

The following consistency levels are available:
  1. ONE :- Only a single replica must respond.
  2. TWO:-Two replicas must respond.
  3. THREE:- Three replicas must respond.
  4. QUORUM:- A majority (n/2 + 1) of the replicas must respond.
  5. ALL:- All of the replicas must respond.
  6. LOCAL_QUORUM:- A majority of the replicas in the local datacenter (whichever datacenter the coordinator is in) must respond.
  7. EACH_QUORUM:- A majority of the replicas in each datacenter must respond.
  8. LOCAL_ONE:- Only a single replica must respond. In a multi-datacenter cluster, this also gaurantees that read requests are not sent to replicas in a remote datacenter.
  9. ANY:- A single replica may respond, or the coordinator may store a hint. If a hint is stored, the coordinator will later attempt to replay the hint and deliver the mutation to the replicas. This consistency level is only accepted for write operations.

Government Jobs