High availability (HA) innebär att hålla databasen tillgänglig även när fel uppstår — genom replication (standby-repliker), automatic failover (att befordra en replik när primären misslyckas) och korrekt arkitektur. Målet: minimera driftöverbrott och dataförlust, eftersom databasavbrott tar ned hela applikationen.
Fundamentet: 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.
