PostgreSQL ? Streaming Replication Using Repmgr
PostgreSQL ? Streaming Replication Using Repmgr
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 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 7. Create Data directory, tablespaces directory and archive WAL directory on standby
PD 4
PostgreSQL Streaming Replication by Using Repmgr Tool
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.
Step 12. Connect primary server and create repmgr database to store repmgr replication
information.
PD 6
PostgreSQL Streaming Replication by Using Repmgr Tool
Step 14. Register Primary PostgreSQL server as primary in Repmgr - On Primary server
PD 7
PostgreSQL Streaming Replication by Using Repmgr Tool
Step 17. Start standby server and register as standby in repmgr configuration.
PD 8
PostgreSQL Streaming Replication by Using Repmgr Tool
PD 9
PostgreSQL Streaming Replication by Using Repmgr Tool
Thank You
PD 10