repmgr

repmgr : Replication manager for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
9710
repmgr
repmgr
5.5.0
ETL
GPL-3.0
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--
No
Yes
Yes
Yes
no
no
Relationships
Schemasrepmgr
See Also
pglogical
pg_failover_slots
pgactive
bgw_replstatus
postgres_fdw
pglogical_origin
pglogical_ticker
dblink

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
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 / PGPG18PG17PG16PG15PG14
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
PackageVersionOSORGSIZEFile URL
repmgr_165.5.0el8.x86_64pgdg293.0 KiBrepmgr_16-5.5.0-1PGDG.rhel8.x86_64.rpm
repmgr_165.4.1el8.x86_64pgdg291.6 KiBrepmgr_16-5.4.1-1PGDG.rhel8.x86_64.rpm
repmgr_165.5.0el8.aarch64pgdg282.6 KiBrepmgr_16-5.5.0-1PGDG.rhel8.aarch64.rpm
repmgr_165.4.1el8.aarch64pgdg280.9 KiBrepmgr_16-5.4.1-1PGDG.rhel8.aarch64.rpm
repmgr_165.5.0el9.x86_64pgdg268.1 KiBrepmgr_16-5.5.0-1PGDG.rhel9.x86_64.rpm
repmgr_165.4.1el9.x86_64pgdg266.8 KiBrepmgr_16-5.4.1-1PGDG.rhel9.x86_64.rpm
repmgr_165.5.0el9.aarch64pgdg261.2 KiBrepmgr_16-5.5.0-1PGDG.rhel9.aarch64.rpm
repmgr_165.4.1el9.aarch64pgdg261.1 KiBrepmgr_16-5.4.1-1PGDG.rhel9.aarch64.rpm
repmgr_165.5.0el10.x86_64pgdg270.4 KiBrepmgr_16-5.5.0-3PGDG.rhel10.x86_64.rpm
repmgr_165.5.0el10.aarch64pgdg261.6 KiBrepmgr_16-5.5.0-3PGDG.rhel10.aarch64.rpm
postgresql-16-repmgr5.5.0d12.x86_64pgdg244.8 KiBpostgresql-16-repmgr_5.5.0+debpgdg-3.pgdg12+1_amd64.deb
postgresql-16-repmgr5.5.0d12.aarch64pgdg223.3 KiBpostgresql-16-repmgr_5.5.0+debpgdg-3.pgdg12+1_arm64.deb
postgresql-16-repmgr5.5.0d13.x86_64pgdg244.5 KiBpostgresql-16-repmgr_5.5.0+debpgdg-3.pgdg13+1_amd64.deb
postgresql-16-repmgr5.5.0d13.aarch64pgdg222.6 KiBpostgresql-16-repmgr_5.5.0+debpgdg-3.pgdg13+1_arm64.deb
postgresql-16-repmgr5.5.0u22.x86_64pgdg233.7 KiBpostgresql-16-repmgr_5.5.0+debpgdg-3.pgdg22.04+1_amd64.deb
postgresql-16-repmgr5.5.0u22.aarch64pgdg209.9 KiBpostgresql-16-repmgr_5.5.0+debpgdg-3.pgdg22.04+1_arm64.deb
postgresql-16-repmgr5.5.0u24.x86_64pgdg229.5 KiBpostgresql-16-repmgr_5.5.0+debpgdg-3.pgdg24.04+1_amd64.deb
postgresql-16-repmgr5.5.0u24.aarch64pgdg205.4 KiBpostgresql-16-repmgr_5.5.0+debpgdg-3.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
repmgr_155.5.0el8.x86_64pgdg291.7 KiBrepmgr_15-5.5.0-1PGDG.rhel8.x86_64.rpm
repmgr_155.4.1el8.x86_64pgdg290.4 KiBrepmgr_15-5.4.1-1PGDG.rhel8.x86_64.rpm
repmgr_155.4.0el8.x86_64pgdg289.9 KiBrepmgr_15-5.4.0-1.rhel8.x86_64.rpm
repmgr_155.3.3el8.x86_64pgdg286.4 KiBrepmgr_15-5.3.3-1.rhel8.x86_64.rpm
repmgr_155.5.0el8.aarch64pgdg282.3 KiBrepmgr_15-5.5.0-1PGDG.rhel8.aarch64.rpm
repmgr_155.4.1el8.aarch64pgdg280.8 KiBrepmgr_15-5.4.1-1PGDG.rhel8.aarch64.rpm
repmgr_155.4.0el8.aarch64pgdg280.4 KiBrepmgr_15-5.4.0-1.rhel8.aarch64.rpm
repmgr_155.3.3el8.aarch64pgdg276.5 KiBrepmgr_15-5.3.3-1.rhel8.aarch64.rpm
repmgr_155.5.0el9.x86_64pgdg270.1 KiBrepmgr_15-5.5.0-1PGDG.rhel9.x86_64.rpm
repmgr_155.4.1el9.x86_64pgdg268.7 KiBrepmgr_15-5.4.1-1PGDG.rhel9.x86_64.rpm
repmgr_155.4.0el9.x86_64pgdg268.6 KiBrepmgr_15-5.4.0-1.rhel9.x86_64.rpm
repmgr_155.3.3el9.x86_64pgdg266.8 KiBrepmgr_15-5.3.3-1.rhel9.x86_64.rpm
repmgr_155.5.0el9.aarch64pgdg263.0 KiBrepmgr_15-5.5.0-1PGDG.rhel9.aarch64.rpm
repmgr_155.4.1el9.aarch64pgdg263.0 KiBrepmgr_15-5.4.1-1PGDG.rhel9.aarch64.rpm
repmgr_155.4.0el9.aarch64pgdg262.8 KiBrepmgr_15-5.4.0-1.rhel9.aarch64.rpm
repmgr_155.5.0el10.x86_64pgdg270.8 KiBrepmgr_15-5.5.0-3PGDG.rhel10.x86_64.rpm
repmgr_155.5.0el10.aarch64pgdg262.3 KiBrepmgr_15-5.5.0-3PGDG.rhel10.aarch64.rpm
postgresql-15-repmgr5.5.0d12.x86_64pgdg243.8 KiBpostgresql-15-repmgr_5.5.0+debpgdg-3.pgdg12+1_amd64.deb
postgresql-15-repmgr5.5.0d12.aarch64pgdg222.1 KiBpostgresql-15-repmgr_5.5.0+debpgdg-3.pgdg12+1_arm64.deb
postgresql-15-repmgr5.5.0d13.x86_64pgdg242.4 KiBpostgresql-15-repmgr_5.5.0+debpgdg-3.pgdg13+1_amd64.deb
postgresql-15-repmgr5.5.0d13.aarch64pgdg221.9 KiBpostgresql-15-repmgr_5.5.0+debpgdg-3.pgdg13+1_arm64.deb
postgresql-15-repmgr5.5.0u22.x86_64pgdg234.8 KiBpostgresql-15-repmgr_5.5.0+debpgdg-3.pgdg22.04+1_amd64.deb
postgresql-15-repmgr5.5.0u22.aarch64pgdg211.2 KiBpostgresql-15-repmgr_5.5.0+debpgdg-3.pgdg22.04+1_arm64.deb
postgresql-15-repmgr5.5.0u24.x86_64pgdg230.3 KiBpostgresql-15-repmgr_5.5.0+debpgdg-3.pgdg24.04+1_amd64.deb
postgresql-15-repmgr5.5.0u24.aarch64pgdg206.1 KiBpostgresql-15-repmgr_5.5.0+debpgdg-3.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
repmgr_145.5.0el8.x86_64pgdg289.7 KiBrepmgr_14-5.5.0-1PGDG.rhel8.x86_64.rpm
repmgr_145.4.1el8.x86_64pgdg288.5 KiBrepmgr_14-5.4.1-1PGDG.rhel8.x86_64.rpm
repmgr_145.4.0el8.x86_64pgdg288.0 KiBrepmgr_14-5.4.0-1.rhel8.x86_64.rpm
repmgr_145.3.3el8.x86_64pgdg284.4 KiBrepmgr_14-5.3.3-1.rhel8.x86_64.rpm
repmgr_145.3.2el8.x86_64pgdg296.4 KiBrepmgr_14-5.3.2-1.rhel8.x86_64.rpm
repmgr_145.3.1el8.x86_64pgdg296.6 KiBrepmgr_14-5.3.1-1.rhel8.x86_64.rpm
repmgr_145.3.0el8.x86_64pgdg296.0 KiBrepmgr_14-5.3.0-1.rhel8.x86_64.rpm
repmgr_145.5.0el8.aarch64pgdg280.9 KiBrepmgr_14-5.5.0-1PGDG.rhel8.aarch64.rpm
repmgr_145.4.1el8.aarch64pgdg279.2 KiBrepmgr_14-5.4.1-1PGDG.rhel8.aarch64.rpm
repmgr_145.4.0el8.aarch64pgdg278.9 KiBrepmgr_14-5.4.0-1.rhel8.aarch64.rpm
repmgr_145.3.3el8.aarch64pgdg275.3 KiBrepmgr_14-5.3.3-1.rhel8.aarch64.rpm
repmgr_145.5.0el9.x86_64pgdg269.3 KiBrepmgr_14-5.5.0-1PGDG.rhel9.x86_64.rpm
repmgr_145.4.1el9.x86_64pgdg268.2 KiBrepmgr_14-5.4.1-1PGDG.rhel9.x86_64.rpm
repmgr_145.4.0el9.x86_64pgdg267.9 KiBrepmgr_14-5.4.0-1.rhel9.x86_64.rpm
repmgr_145.3.3el9.x86_64pgdg266.0 KiBrepmgr_14-5.3.3-1.rhel9.x86_64.rpm
repmgr_145.3.2el9.x86_64pgdg279.2 KiBrepmgr_14-5.3.2-1.rhel9.x86_64.rpm
repmgr_145.3.1el9.x86_64pgdg278.7 KiBrepmgr_14-5.3.1-1.rhel9.x86_64.rpm
repmgr_145.5.0el9.aarch64pgdg262.4 KiBrepmgr_14-5.5.0-1PGDG.rhel9.aarch64.rpm
repmgr_145.4.1el9.aarch64pgdg262.3 KiBrepmgr_14-5.4.1-1PGDG.rhel9.aarch64.rpm
repmgr_145.4.0el9.aarch64pgdg262.1 KiBrepmgr_14-5.4.0-1.rhel9.aarch64.rpm
repmgr_145.5.0el10.x86_64pgdg269.9 KiBrepmgr_14-5.5.0-3PGDG.rhel10.x86_64.rpm
repmgr_145.5.0el10.aarch64pgdg261.2 KiBrepmgr_14-5.5.0-3PGDG.rhel10.aarch64.rpm
postgresql-14-repmgr5.5.0d12.x86_64pgdg243.0 KiBpostgresql-14-repmgr_5.5.0+debpgdg-3.pgdg12+1_amd64.deb
postgresql-14-repmgr5.5.0d12.aarch64pgdg222.2 KiBpostgresql-14-repmgr_5.5.0+debpgdg-3.pgdg12+1_arm64.deb
postgresql-14-repmgr5.5.0d13.x86_64pgdg241.6 KiBpostgresql-14-repmgr_5.5.0+debpgdg-3.pgdg13+1_amd64.deb
postgresql-14-repmgr5.5.0d13.aarch64pgdg221.1 KiBpostgresql-14-repmgr_5.5.0+debpgdg-3.pgdg13+1_arm64.deb
postgresql-14-repmgr5.5.0u22.x86_64pgdg233.3 KiBpostgresql-14-repmgr_5.5.0+debpgdg-3.pgdg22.04+1_amd64.deb
postgresql-14-repmgr5.5.0u22.aarch64pgdg209.9 KiBpostgresql-14-repmgr_5.5.0+debpgdg-3.pgdg22.04+1_arm64.deb
postgresql-14-repmgr5.5.0u24.x86_64pgdg229.6 KiBpostgresql-14-repmgr_5.5.0+debpgdg-3.pgdg24.04+1_amd64.deb
postgresql-14-repmgr5.5.0u24.aarch64pgdg205.5 KiBpostgresql-14-repmgr_5.5.0+debpgdg-3.pgdg24.04+1_arm64.deb

Source

Install

Make sure PGDG repo available:

pig repo add pgdg -u    # add pgdg repo and update cache

Install 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 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'repmgr';

Create this extension with:

CREATE EXTENSION repmgr;

Usage

repmgr: Replication manager for PostgreSQL

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 register

Clone 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 register

Monitoring

# Show cluster status
repmgr -f /etc/repmgr.conf cluster show

# Show replication status
repmgr -f /etc/repmgr.conf node status

Manual Switchover

Promote a standby to primary (planned switchover):

repmgr -f /etc/repmgr.conf standby switchover

Automatic Failover with repmgrd

Start the repmgr daemon on each node:

repmgrd -f /etc/repmgr.conf

Configure 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 node
  • repmgr standby clone - clone a standby from primary
  • repmgr standby register - register a standby node
  • repmgr standby promote - promote standby to primary
  • repmgr standby follow - follow a new primary
  • repmgr standby switchover - planned switchover
  • repmgr cluster show - display cluster status
  • repmgr cluster event - show cluster events
  • repmgr node check - health check a node
Last updated on