Reference · Cheat sheet

Replication

Async by default — fast, but a failover can lose writes. Print it, pin it.

From lesson 0006See also glossary

The model

Sync (PSYNC = replication ID + offset)

ResyncWhenCost
PartialReconnect, gap still in the backlog bufferShip only the missed stream slice
FullFirst sync, or backlog too oldBGSAVE → RDB streamed → replay buffered writes

repl-diskless-sync: stream the RDB over the socket, skipping disk.

The async trade-off

Not a CP system

Ack comes before replicas confirm, so "acknowledged writes can still be lost during a failover." There is always a window for data loss.

Narrow the window with…Effect
WAIT n timeoutBlock until ≥ n replicas ack (or timeout). Best-effort, not CP.
min-replicas-to-write N + min-replicas-max-lag MRefuse writes unless ≥ N replicas with lag < M s. Bounds loss to ~M s.
Replica expiry

Replicas don't expire keys — they wait for the primary's synthesized DEL, hiding logically-dead keys on reads. A promoted replica then expires independently.

Handy commands

← lesson 0006 · Sources: Redis Docs — Replication · WAIT