Why it matters
Every serious production DB uses replication. Getting the setup right shapes availability, latency, and consistency. Understanding options is core DB ops.
Advertisement
The architecture
Streaming replication: primary sends WAL/binlog stream to replicas. Replica applies to catch up.
Logical replication: primary sends row-level changes. Enables cross-version and selective replication.
Advertisement
How it works end to end
Sync replication: primary waits for replica ack before commit. Strong consistency, higher write latency.
Async replication: primary commits, replica catches up. Lower latency, replica may lag.
Failover: replica promoted when primary fails. Manual or automatic. Auto-failover risks split brain.
Read replicas: applications route reads to replicas for scale. Watch for stale-read issues.