- Michael Vitale
- 4th May 2020
- Database, pgbackrest, postgres, postgresql, repmgr
From the docs: “repmgr is an open-source tool suite for managing replication and failover in a cluster of PostgreSQL servers.”
For a standby node to be used in a repmgr configuration, it has to be registered. Normally you do this by allowing repmgr to clone the standby first. If a node was not cloned by repmgr, you can nonetheless register it using the -F/–force option. This is useful for cases where you want to use another tool (like pgbackrest) to backup and restore your clusters.
repmgr uses pg_basebackup by default and has configuration parameters for Barman, but nothing for other 3rd party tools. This example uses repmgr 5.1 and PostgreSQL 12.2 and assumes we have an active PG cluster using streaming replication where the standby node was initially restored by pgbackrest. From the standby execute the following 2 commands:
repmgr standby register --force -d 'host=mystandby port=5432 user=repmgr password=mypassword'
repmgr -f /etc/repmgr/12/repmgr.conf standby follow
Validate that the standby is a part of the repmgr cluster:
repmgr -f /etc/repmgr/12/repmgr.conf node check
repmgr cluster show
Michael Vitale, Team Elephas
Leave a comment
Categories
Recent Blog
- Do you really need a DBA?
- Running VACUUM FULL in Non-blocking Mode
- Connection Scaling
- PSQL Helper: Managing Connections and Simplifying Queries
- Vacuum Those MVs!
- Working With Repmgr: Using Other 3rd Party Tools for Setting up a Standby
- Working with Amazon Aurora PostgreSQL: dag, standby rebooted again!
- Working with Amazon Aurora PostgreSQL: what happened to the stats?
- How to set application_name for psql command line utility?
- Is there a limit on number of partitions handled by Postgres?
FYI, repmgr provides an option “repmgr standby clone –recovery-conf-only”, which will create the necessary replication configuration for a node restored from another data source (including creating a replication slot on the upstream node if required); the node can then be safely started as a standby and registered.
See documentation for details: https://repmgr.org/docs/current/repmgr-standby-clone.html#REPMGR-STANDBY-CREATE-RECOVERY-CONF