Replication & High Availability
Master database replication and high availability — primary-replica, failover, clustering, and zero-downtime architectures.
45 min•By Priygop Team•Last updated: Feb 2026
Replication & HA
- Primary-Replica: Primary handles writes, replicas handle reads — distributes read load. Asynchronous (fast, slight lag) or synchronous (consistent, slower writes). Read replicas for reporting
- Failover: If primary fails, promote a replica to primary — automatic (Patroni for PostgreSQL, MHA for MySQL) or manual. DNS/proxy routing switches application connections
- Multi-Primary: Both nodes accept writes — conflict resolution required. MySQL Group Replication, Galera Cluster. Use for high write availability, not performance
- Sharding: Split data across multiple databases by key (user_id % 4 → shard 0-3) — scales writes horizontally. Complex to implement. Use only when single database can't handle load
- Connection Routing: ProxySQL, PgBouncer — route reads to replicas, writes to primary automatically. Application doesn't need to know about topology. Health checks remove failed nodes
- Cloud-Managed: AWS RDS, Google Cloud SQL, Azure Database — automated backups, patching, failover, scaling. Higher cost but dramatically less operational burden
Try It Yourself: Database Monitor
Try It Yourself: Database MonitorHTML
HTML Editor
✓ ValidTab = 2 spaces
HTML|37 lines|2017 chars|✓ Valid syntax
UTF-8