repmgr
repmgr
repmgr : Replication manager for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 9710 | repmgr
|
repmgr
|
5.5.0 |
ETL
|
GPL-3.0
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sLd--
|
No
|
Yes
|
Yes
|
Yes
|
no
|
no
|
| Relationships | |
|---|---|
| Schemas | repmgr |
| See Also | pglogical
pg_failover_slots
pgactive
bgw_replstatus
postgres_fdw
pglogical_origin
pglogical_ticker
dblink
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG
|
5.5.0 |
18
17
16
15
14
|
repmgr |
- |
| RPM | PGDG
|
5.5.0 |
18
17
16
15
14
|
repmgr_$v |
- |
| DEB | PGDG
|
5.5.0 |
18
17
16
15
14
|
postgresql-$v-repmgr |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
el8.aarch64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
el9.x86_64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
el9.aarch64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
el10.x86_64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
el10.aarch64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
d12.x86_64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
d12.aarch64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
d13.x86_64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
d13.aarch64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
u22.x86_64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
u22.aarch64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
u24.x86_64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
u24.aarch64
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
PGDG 5.5.0
|
Source
Install
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install repmgr; # install via package name, for the active PG version
pig install repmgr -v 18; # install for PG 18
pig install repmgr -v 17; # install for PG 17
pig install repmgr -v 16; # install for PG 16
pig install repmgr -v 15; # install for PG 15
pig install repmgr -v 14; # install for PG 14Config this extension to shared_preload_libraries:
shared_preload_libraries = 'repmgr';Create this extension with:
CREATE EXTENSION repmgr;Usage
A suite of tools to manage replication and failover within a PostgreSQL cluster. Supports setting up standby servers, monitoring replication, and performing failover/switchover.
Enabling
CREATE EXTENSION repmgr;Configuration
Create repmgr.conf on each node:
node_id=1
node_name='node1'
conninfo='host=node1 dbname=repmgr user=repmgr'
data_directory='/var/lib/postgresql/data'Register Primary
repmgr -f /etc/repmgr.conf primary registerClone and Register Standby
# Clone from primary
repmgr -h primary-host -U repmgr -d repmgr -f /etc/repmgr.conf standby clone
# Start the standby
pg_ctl -D /var/lib/postgresql/data start
# Register the standby
repmgr -f /etc/repmgr.conf standby registerMonitoring
# Show cluster status
repmgr -f /etc/repmgr.conf cluster show
# Show replication status
repmgr -f /etc/repmgr.conf node statusManual Switchover
Promote a standby to primary (planned switchover):
repmgr -f /etc/repmgr.conf standby switchoverAutomatic Failover with repmgrd
Start the repmgr daemon on each node:
repmgrd -f /etc/repmgr.confConfigure failover in repmgr.conf:
failover='automatic'
promote_command='repmgr standby promote -f /etc/repmgr.conf'
follow_command='repmgr standby follow -f /etc/repmgr.conf --upstream-node-id=%n'Key Commands
repmgr primary register- register a primary noderepmgr standby clone- clone a standby from primaryrepmgr standby register- register a standby noderepmgr standby promote- promote standby to primaryrepmgr standby follow- follow a new primaryrepmgr standby switchover- planned switchoverrepmgr cluster show- display cluster statusrepmgr cluster event- show cluster eventsrepmgr node check- health check a node
Last updated on