Skip to main content
RunBook Academy

LinuxLX · Distributed Storage ConceptsReplication

Replication, quorum, and consistency - the distributed storage discipline

Advanced⏱ ~10 minbash

What you'll learn

  • Explain replication factor and quorum
  • Distinguish sync and async replication
  • Apply the CAP theorem in practice
  • Choose consistency levels for the workload

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

Distributed storage replicates data across nodes and maintains consistency through quorum. This lesson covers the discipline.

Replication factor

Replication factor (RF) is the number of copies of each piece of data:

  • RF=1: no replication. Single point of failure.
  • RF=2: one primary, one replica. Tolerates one failure.
  • RF=3: two replicas. Tolerates two failures. Standard for production.

Higher RF: more reliability, more storage cost.

Write quorum and read quorum

For a write to be acknowledged, it must be written to a write quorum (Wq) of nodes. For a read to be considered current, it must be read from a read quorum (Rq) of nodes.

Strong consistency: Wq + Rq > N (e.g. Wq=2, Rq=2, N=3).

For RF=3:

  • Wq=2, Rq=2: strong consistency. Reads always see the latest write.
  • Wq=1, Rq=1: weak consistency. Reads may see stale data.

For most production: Wq=2, Rq=2 (or Wq=3, Rq=1 for read-heavy).

Sync vs async replication

  • Sync: write is acknowledged only after all replicas confirm. High latency, strong consistency.
  • Async: write is acknowledged immediately, replicas catch up. Low latency, eventual consistency.

For RF=3, sync replication means the write is acked after 2 of 3 replicas confirm. The third catches up later.

CAP theorem

CAP says you can have at most two of:

  • Consistency: all nodes see the same data at the same time.
  • Availability: every request gets a response.
  • Partition tolerance: the system continues despite network partitions.

In practice, partition tolerance is required (networks fail). So the choice is between consistency and availability. Most distributed systems choose availability (eventual consistency).

Quorum and split brain

A partition splits the cluster. Each side has some nodes. For a write to be acknowledged, a quorum must be reached:

  • 3 nodes, RF=3, Wq=2: 2 nodes on one side, 1 on the other. The side with 2 has quorum. The side with 1 does not.
  • The minority cannot write. Reads may be stale or refused.

Quorum prevents split brain. The minority cannot make decisions.

Erasure coding

Replication is expensive (3x for RF=3). Erasure coding is a more efficient alternative:

  • Split data into k data fragments.
  • Generate m parity fragments.
  • Total: k + m fragments.
  • Can recover from up to m lost fragments.

For k=4, m=2: 6 fragments total, can recover from 2 lost. Storage efficiency: 4/6 = 67% (vs 33% for RF=3).

Ceph supports erasure coding. For cold data, EC is significantly cheaper.

Knowledge check

Knowledge check · 3 questions

  1. Q1. What is the standard replication factor for production?

  2. Q2. Strong consistency is always the right choice.

  3. Q3. Which of the following are valid CAP trade-offs? Select all that apply.

Passing score: 75%. Answers are checked in this browser.