Apache Cassandra
Replication Strategies: SimpleStrategy vs NetworkTopologyStrategy
Learn how Cassandra places replicas across nodes and datacenters using pluggable replication strategies.
Replication strategy is a keyspace-level setting that determines how many copies of each piece of data exist and where those copies are placed across the cluster. It directly affects both fault tolerance and read/write availability.
SimpleStrategy is like photocopying a document and handing copies to the next few people in line, regardless of which building they work in. NetworkTopologyStrategy is like deliberately sending copies to different offices in different cities so a single building fire can't destroy every copy.
Key Concepts
1
SimpleStrategy places replicas on the next N nodes around the ring in a clockwise direction, without any awareness of datacenter or rack topology. It's intended only for single-datacenter deployments or development/testing environments.
SimpleStrategy
2
NetworkTopologyStrategy is topology-aware and is the recommended strategy for any production deployment, especially multi-datacenter clusters. It allows specifying a different replication factor per datacenter, and it intelligently places replicas across different racks within a datacenter to avoid correlated hardware failures taking out multiple replicas at once.
NetworkTopologyStrategy
3
Changing replication strategy or replication factor requires running nodetool repair afterward to ensure existing data is properly redistributed to match the new replica placement rules.
nodetool repair