高可用性 (HA) 意味着即使在发生故障时也要保持数据库可用 — 通过 replication(standby 副本)、automatic failover(当主库故障时提升副本),以及适当的架构。目标:最小化停机时间和数据丢失,因为数据库故障会导致整个应用程序瘫痪。
基础:replication + automatic failover
Primary ──(streaming replication)──▶ Standby replica(s)
If the PRIMARY fails:
→ a STANDBY is automatically PROMOTED to become the new primary (FAILOVER)
→ the application reconnects to the new primary → minimal downtime
→ Without HA, a primary failure = total database outage = application down.
Replication 保持 standby 副本同步; 检测主库故障并提升副本 — 将完全中断转变为短暂的服务中断。
