pgautofailover
pg_auto_failover
pgautofailover : pg_auto_failover
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 5150 | pgautofailover | pgautofailover | 2.2 |
ADMIN | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| Requires | btree_gist |
| See Also | repmgr pg_failover_slots bgw_replstatus pgpool_adm pglogical pgactive pglogical_ticker |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 2.2 |
18 17 16 15 14 | pgautofailover |
btree_gist |
| RPM | PGDG | 2.2 |
18 17 16 15 14 | pg_auto_failover_$v |
- |
| DEB | PGDG | 2.2 |
18 17 16 15 14 | postgresql-$v-auto-failover |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el8.aarch64 | PIGSTY 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el9.x86_64 | PIGSTY 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el9.aarch64 | PIGSTY 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el10.x86_64 | PIGSTY 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| el10.aarch64 | PIGSTY 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| d12.x86_64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| d12.aarch64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| d13.x86_64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| d13.aarch64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| u22.x86_64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| u22.aarch64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| u24.x86_64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| u24.aarch64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| u26.x86_64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
| u26.aarch64 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 | PGDG 2.2 |
Source
github.com/hapostgres/pg_auto_failover
Install
Make sure PGDG repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
pg_auto_failover is an extension and service for automated PostgreSQL failover. It consists of a monitor node (running the pgautofailover extension), and keeper processes on each data node managed by the pg_autoctl CLI.
Architecture
- Monitor: a PostgreSQL instance with the
pgautofailoverextension that implements a state machine for failover decisions - Keeper (
pg_autoctl run): runs on each data node, reports health to the monitor and executes state transitions - Supports 2+ node setups with synchronous replication by default
- Supports Citus HA (since v2.0)
Key CLI Commands
Failover Behavior
The monitor tracks node health. When a secondary becomes unavailable or its lag is too high, it is removed from synchronous_standby_names on the primary. Failover/switchover operations are blocked until the secondary is healthy again, preventing data loss.
Documentation
Full documentation: pg-auto-failover.readthedocs.io