0% found this document useful (0 votes)
12 views10 pages

PostgreSQL ? Streaming Replication Using Repmgr

The document outlines the process of setting up PostgreSQL Streaming Replication using the Repmgr tool, detailing the necessary configurations and steps for both primary and standby databases. It emphasizes the importance of identical PostgreSQL versions and provides a step-by-step guide from verifying server settings to verifying replication status. Repmgr is highlighted as a tool that simplifies management tasks such as automated failover and monitoring in PostgreSQL replication clusters.

Uploaded by

naren sy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views10 pages

PostgreSQL ? Streaming Replication Using Repmgr

The document outlines the process of setting up PostgreSQL Streaming Replication using the Repmgr tool, detailing the necessary configurations and steps for both primary and standby databases. It emphasizes the importance of identical PostgreSQL versions and provides a step-by-step guide from verifying server settings to verifying replication status. Repmgr is highlighted as a tool that simplifies management tasks such as automated failover and monitoring in PostgreSQL replication clusters.

Uploaded by

naren sy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

PostgreSQL Streaming Replication by Using Repmgr Tool

Primary Database Standby Database


PostgreSQL Version 17v 17v
Data directory /u01/pgserver/cluster01 /u01/pgserver/cluster01
Binary Location /usr/pgsql-17/bin /usr/pgsql-17/bin
Port Number 5432 5432
Tablespace’s /u02/tbs01, /u02/tbs02 /u02/tbs01, /u02/tbs02
WAL archive Directory /u01/pgserver/archives /u01/pgserver/archives

Note: For PostgreSQL streaming replication, the major version of PostgreSQL on both the primary and
standby servers must be identical. However, minor version differences (e.g., 17.1 vs. 17.2) are
generally supported and do not affect replication compatibility.

Streaming Replication is a PostgreSQL method that enables real-time data replication from a primary
server to one or more standby (replica) servers. It continuously sends the Write-Ahead Log (WAL) data
from the primary to the standby servers over a network connection. This ensures that the standby

PD 1
PostgreSQL Streaming Replication by Using Repmgr Tool

servers are nearly up to date with the primary, allowing for high availability, disaster recovery, and load
balancing for read-only queries.

repmgr (Replication Manager) is an open-source tool developed by EnterpriseDB that simplifies and
automates the management of PostgreSQL streaming replication clusters. Helps with Automated
failover, switchover, and monitoring.

Note: Without a replication manager, we can only do a failover(promote), not a switchover in one
command. And We have used the same data directory location on both the primary and standby
systems to avoid conflicts. It is highly recommended to keep the same path.

Step 1. Verify the PostgreSQL primary server data directory, tablespaces and archive mode

PD 2
PostgreSQL Streaming Replication by Using Repmgr Tool

Step 2. Modify replication-related parameters on the Primary server in postgresql.conf file

Step 3. Modify Access control parameter to allow the remote connection for replication in
pg_hba.conf

PD 3
PostgreSQL Streaming Replication by Using Repmgr Tool

Step 4. Once All parameters updated then restart PostgreSQL database server.

Step 5. On standby server Install PostgreSQL repository and 17v software.

sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-


redhat-repo-latest.noarch.rpm

dnf install -y postgresql17-server postgresql17-contrib

Step 6. Setup Postgres User password on standby server

Step 7. Create Data directory, tablespaces directory and archive WAL directory on standby

PD 4
PostgreSQL Streaming Replication by Using Repmgr Tool

Step 8. Create environment variable file on standby to execute PostgreSQL utilities.

Step 9. Perform the Passwordless ssh configuration (User equivlance Configuration) between
primary and Standby servers

Step 10. Install replication manager(repmgr) software on both primary and standby server.

PD 5
PostgreSQL Streaming Replication by Using Repmgr Tool

Step 11. On Both primary and standby Configure repmgr parameter in repmgr configuration
file.

By default location - /etc/repmgr/17/repmgr.conf

 On Primary Add below lines in /etc/repmgr/17/repmgr.conf – root user

Step 12. Connect primary server and create repmgr database to store repmgr replication
information.

PD 6
PostgreSQL Streaming Replication by Using Repmgr Tool

Step 13. On Standby Add below lines in /etc/repmgr/17/repmgr.conf – root user

Step 14. Register Primary PostgreSQL server as primary in Repmgr - On Primary server

Step 15. Configure or Build standby By Cloning Primary server

PD 7
PostgreSQL Streaming Replication by Using Repmgr Tool

Step 16. Change IP address on Standby server in postgresql.conf file

Step 17. Start standby server and register as standby in repmgr configuration.

Step 18. Verify repmgr status and replication manager

PD 8
PostgreSQL Streaming Replication by Using Repmgr Tool

Step 19. Verify Replication on primary and standby

PD 9
PostgreSQL Streaming Replication by Using Repmgr Tool

Thank You

PD 10

You might also like