← Lessons

quiz vs the machine

Gold1360

Databases

Cassandra Replication Factor

How many copies of data Cassandra keeps and where they land.

5 min read · core · beat Gold to climb

Replication factor

The replication factor (RF) is how many copies of each row Cassandra stores. It is set per keyspace.

  • RF of 3 means three nodes each hold a copy of every partition in that keyspace.
  • Higher RF improves durability and availability but costs more storage and write work.

Where replicas go

Starting from the node that owns the token, Cassandra walks the ring to place the remaining replicas. The replication strategy controls the rules.

  • SimpleStrategy places replicas on the next nodes around the ring, ignoring topology. Use only for a single data center test setup.
  • NetworkTopologyStrategy places replicas across racks and data centers so a rack or DC failure does not lose all copies.

Per data center RF

With NetworkTopologyStrategy you set RF per data center, for example three copies in each of two regions.

  • This supports local reads and disaster recovery.
  • It tries to put replicas in distinct racks to survive rack failures.

Diagram

Key idea

Replication factor sets how many copies exist, and NetworkTopologyStrategy decides where they go to survive rack and data center failures.

Check yourself

Answer to earn rating on the learn ladder.

1. An RF of 3 means what?

2. Which strategy is recommended for production across data centers?