Show Patroni cluster status, topology and history
PostgreSQLPatroniCommand
# Members, roles, state, timeline and lag (MB):
patronictl -c /etc/patroni/patroni.yml list <cluster>
# Extended info (pending restart, tags) + timestamp, refresh every 5 s:
patronictl -c /etc/patroni/patroni.yml list <cluster> -e -t -w 5
# Leader -> replica tree (including cascading replicas):
patronictl -c /etc/patroni/patroni.yml topology <cluster>
# Past failovers/switchovers (timeline, LSN, reason, time):
patronictl -c /etc/patroni/patroni.yml history <cluster>What it does
Shows Patroni's cluster view from the DCS: leader/replica roles, member state (running/streaming), timeline, replication lag and pending restarts; history lists timeline changes with the LSN at which they happened.
When to use it
Before and after every switchover/failover/maintenance, and as the first diagnostic step when an alert fires.
Caution
The output reflects what is stored in the DCS; if the DCS is unreachable the command fails or may show stale data. Do not start a switchover before confirming all members are on the same timeline and Lag in MB is below maximum_lag_on_failover.
Related
- 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
- Put Patroni into maintenance mode and back (pause/resume)
- Check Patroni DCS (etcd/Consul) and REST API health