Put Patroni into maintenance mode and back (pause/resume)
PostgreSQLPatroniCommand
# Maintenance mode: automatic failover and Patroni's control over PostgreSQL stop
patronictl -c /etc/patroni/patroni.yml pause <cluster> --wait
patronictl -c /etc/patroni/patroni.yml list <cluster> # should show 'Maintenance mode: on'
# ... maintenance work (e.g. manual PostgreSQL restart, DCS maintenance) ...
patronictl -c /etc/patroni/patroni.yml resume <cluster> --waitWhat it does
Puts the cluster in maintenance mode: Patroni performs no automatic failover and does not restart a stopped PostgreSQL; resume returns to normal management.
When to use it
During DCS (etcd/Consul) maintenance, Patroni upgrades, or when PostgreSQL must be managed manually without Patroni interfering.
Caution
If the primary crashes while paused there is no automatic failover and the outage continues. Do not forget to resume after maintenance; add a 'Maintenance mode' check to your alerting. Manually starting a PostgreSQL as primary while paused can cause split-brain.
Related
- Show Patroni cluster status, topology and history
- Perform a planned switchover with Patroni
- Perform a manual failover with Patroni
- Rebuild a broken replica with Patroni (reinit)
- Change cluster-wide parameters in Patroni (edit-config) and apply pending restarts
- Check Patroni DCS (etcd/Consul) and REST API health