Reference · Cheat sheet
Async by default — fast, but a failover can lose writes. Print it, pin it.
replica-read-only yes) — writes go to the primary.| Resync | When | Cost |
|---|---|---|
| Partial | Reconnect, gap still in the backlog buffer | Ship only the missed stream slice |
| Full | First sync, or backlog too old | BGSAVE → RDB streamed → replay buffered writes |
repl-diskless-sync: stream the RDB over the socket, skipping disk.
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 timeout | Block until ≥ n replicas ack (or timeout). Best-effort, not CP. |
min-replicas-to-write N + min-replicas-max-lag M | Refuse writes unless ≥ N replicas with lag < M s. Bounds loss to ~M s. |
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.
REPLICAOF host port — make this node a replica. REPLICAOF NO ONE — promote to primary.INFO replication — role, connected_slaves, master_link_status, offsets.WAIT n timeout — how many replicas have my writes.← lesson 0006 · Sources: Redis Docs — Replication · WAIT