
This template deploys a highly available PostgreSQL cluster using:
Use any of the Patroni nodes to connect to the cluster:
Patroni will automatically route connections to the master node.
| Account | Username | Privileges | Use Case |
|---|---|---|---|
| Superuser | postgres | Full system privileges | System administration, backup/restore |
| Admin | admin | CREATEDB, CREATEROLE | Application connections, daily development |
Security: Use
adminor create dedicated users for applications. Avoid usingsuperuserdirectly.
This 3-node configuration provides standard production HA (tolerates 1 node failure).
| Nodes | Fault Tolerance | Use Case |
|---|---|---|
| 3 | 1 failure | ✅ Production (standard) |
| 5 | 2 failures | ✅ Production (high availability) |
To scale from 3 to 5 nodes for higher availability:
Add etcd nodes:
Add Patroni nodes:
Update existing Patroni ETCD3_HOSTS to include new etcd nodes:
etcd1:2379,etcd2:2379,etcd3:2379,etcd4:2379,etcd5:2379
To scale down the cluster:
⚠️ Important: Never reduce below 3 nodes in production to maintain HA.
📖 Full Guide: See the complete README for step-by-step removal instructions.
Run inside any Patroni container:
# Cluster status
patronictl list pg-ha
# Show cluster configuration
patronictl show-config pg-ha
Common operations:
# Check etcd cluster health
curl http://etcd1:2379/health
# List etcd members
curl -X POST http://etcd1:2379/v3/cluster/member/list
# Check Patroni cluster status (run inside patroni container)
patronictl list pg-ha
# Check PostgreSQL replication
psql -U postgres -c "SELECT * FROM pg_stat_replication;"
📖 Full Troubleshooting Guide: See the complete README.
To change passwords after deployment:
ALTER USER postgres PASSWORD 'new_password';📖 Full Guide: See Password Change Guide
etcd Expansion:
Patroni Expansion: