Database Replication — Leader-Follower, Multi-Leader & Leaderless
Studies in this cluster, in series order. Each one keeps its own URL.
Databases
Indexes, isolation, storage engines, shard and partition keys, and zero-downtime migrations you can ship without a maintenance window.
- 1.Database Replication — Leader-Follower, Multi-Leader & Leaderless QuorumsReplication keeps the same data on several machines for durability, read scale, or multi-region latency. The three shapes are leader-follower, multi-leader, and leaderless. Who may accept a write and when the client hears committed set lag, RPO, failover risk, and whether you must resolve conflicts.
- 2.Sync vs Async vs Semi-Sync Replication — Durability, RPO & Physical vs Logical LogsAsync, semi-sync, quorum, and fully sync commit modes trade latency for RPO. Postgres synchronous_commit levels and physical versus logical logs (plus replication slots) decide what a failover can lose and what CDC can see.
- 3.Replication Lag & Session Guarantees — Read-Your-Writes, Monotonic Reads & Consistent PrefixAsync replicas introduce read-your-writes, monotonic-read, and consistent-prefix anomalies. Fix them with LSN/GTID tokens, sticky replicas, and bounded-staleness routing — measure lag correctly first.
- 4.Failover & Split Brain — Detection, Promotion, Fencing & Lost WritesFailover is detect, elect, pick the most caught-up replica, fence the old leader, promote, repoint, and rewind. Split brain without fencing loses or duplicates writes. Patroni, managed HA, and GitHub 2018 make the trade-offs concrete.
- 5.Multi-Leader & Active-Active — Conflict Detection, LWW, CRDTs & Home RegionsMulti-leader and active-active give local writes in every region and create conflicts. Last-writer-wins can silently drop data; version vectors, CRDTs, and home-region routing are the real tools.
- 6.Leaderless Replication — N/R/W Quorums, Hinted Handoff, Read Repair & Anti-EntropyLeaderless (Dynamo-style) replication uses N/R/W quorums, hinted handoff, read repair, and Merkle anti-entropy. R+W>N is not linearizability. Tombstones and clock-based LWW are the usual footguns.