High Availability
Enterprise-grade PostgreSQL high availability powered by Patroni, ensuring automatic failover and minimal downtime.

Overview
Continuous Operation
Self-healing from hardware failures with zero downtime as long as any instance survives.
Rapid Recovery
30-60 second recovery time for primary failures with minimal data loss.
Data Safety
Configurable consistency levels with optional zero data loss guarantees.
Implementation
Pigsty's high-availability architecture is built on proven technologies:
- PostgreSQL Streaming Replication
Standard streaming replication for physical standby databases, enabling seamless failover.
- Patroni
Manages PostgreSQL processes and orchestrates high-availability operations.
- Etcd
Distributed Configuration Store for leader election and consensus.
- HAProxy
Load balancer for automatic traffic switching and service exposure.
Trade-offs
Recovery Time Objective (RTO)
Default 30s, configurable via pg_rto. Lower values reduce downtime but increase false-positive failovers. Higher values increase stability but extend recovery time.
Recovery Point Objective (RPO)
Default 1MB, configurable via pg_rpo. Lower values minimize data loss but may prevent automatic failovers. Zero RPO available with synchronous replication at the cost of performance.