How can we understand the concept of replication factor in cassandra? -
what replication factor in cassandra , how affect single dc or multiple dc nodes ?
cassandra stores replicas on multiple nodes ensure reliability , fault tolerance. the total number of replicas across cluster referred replication factor. replication factor of 1 means there 1 copy of each row on 1 node. replication factor of 2 means 2 copies of each row, each copy on different node. replicas equally important; there no primary or master replica
when creating keyspace, need specify replication factor on each dc.
example single dc simplestrategy:
create keyspace excelsior replication = { 'class' : 'simplestrategy', 'replication_factor' : 3 };
- here specify replication_factor 3 means, each row placed on 3 different node.
example multi dc :
create keyspace excalibur replication = {'class' : 'networktopologystrategy', 'dc1' : 3, 'dc2' : 2};
- this example sets 3 replicas data center named dc1 , 2 replicas data center named dc2
Comments
Post a Comment