Course contentsShow
← System Design
Lesson 424 of 1,91912. NoSQL: Wide-Column StoresFree lesson

Replication Strategy and Factor

Configuring SimpleStrategy and NetworkTopologyStrategy for data replication across nodes.

Replication Strategy and Factor

What you'll learn: How to configure Cassandra's replication strategies to control where and how many copies of your data exist across the cluster.


Why Replication Matters

In a distributed wide-column store like Cassandra, replication means storing multiple copies of each piece of data on different nodes. This ensures high availability—if one node fails, your data survives on another. But where should those copies go? That's what the replication strategy determines.

Replication Factor

The replication factor (RF) is simply a number: how many copies of each piece of data should exist. An RF of 3 means three nodes hold the same data. Higher RF improves fault tolerance but uses more storage.

SimpleStrategy

SimpleStrategy places replicas on consecutive nodes around the token ring, ignoring physical location. It's straightforward but naïve—replicas might all end up in the same data center or rack.

Use when: You have a single data center and simple infrastructure.

Example (conceptual): With RF=3, the coordinator places one copy on the primary node (determined by the partition key), then one each on the next two nodes clockwise around the ring.

NetworkTopologyStrategy

NetworkTopologyStrategy is rack-aware and data-center-aware. You specify how many replicas per data center, and Cassandra spreads them across racks to avoid correlated failures.

Use when: You have multiple data centers or want production-grade fault tolerance.

Example (conceptual): RF=3 in DC1 and RF=2 in DC2 means five total copies, strategically placed to survive data center or rack outages.


Key Takeaway:
Replication factor controls how many copies exist; replication strategy controls where they're placed—use SimpleStrategy for single-DC simplicity or NetworkTopologyStrategy for multi-DC resilience.