Reputation: 2695
The data is stored on the ring based on rowkeys, but the replica's row key is the same with the original, then the replica would be stored in the same node in the ring. How does cassandra decide where to store the replica?
Upvotes: 0
Views: 224
Reputation: 762
Data partitioner determines coordinator node for each key. The coordinator node is the fist replica for a key which is also called primary replica. If replication factor is N, a key's coordinator node replicates it to other N-1 replicas.
In SimpleStrategy, successor nodes or the nodes on the ring immediate following in clockwise direction to the coordinator node are selected as replicas.
This link may help you: http://distributeddatastore.blogspot.com/2015/08/cassandra-replication.html
You can use nodetool getendpoints
to get the node_ip of the replicas. For example:
nodetool getendpoints <keyspace_name> <table_name> <partition_key>
Sample:
nodetool getendpoints musicdb artist 1
Result:
192.168.122.13
192.168.122.14
192.168.122.12
Upvotes: 2