This needs to be carried out on the secondary (replica) node on the DR database. Note that the commands executed here are different in the secondary node.

  1. Configure the REPMGR configuration file (default located on “/etc/repmgr/10/repmgr.conf”) by changing the configuration as follows:
node_id = 3
node_name = ‘DR’
conninfo = 'host=<local-ip> port=5432 user=repuser dbname=postgres password=<postgres user password>'
replication_type = 'physical'
use_replication_slots = yes
pg_bindir = '/usr/pgsql-10/bin'.
failover = 'automatic' 
priority=0
data_directory = '/var/lib/pgsql/10/data'
promote_command = '/usr/pgsql-10/bin/repmgr standby promote -f /etc/repmgr/10/repmgr.conf --log-to-file'
follow_command = '/usr/pgsql-10/bin/repmgr standby follow -f /etc/repmgr/10/repmgr.conf --log-to-file --upstream-node-id=%n'
monitoring_history = yes
monitor_interval_secs = 10
service_start_command = 'sudo systemctl start postgresql-10'
service_stop_command = 'sudo systemctl stop postgresql-10'
service_restart_command = 'sudo systemctl restart postgresql-10'
service_reload_command = 'sudo systemctl reload postgresql-10'
  1. After changing the above configurations, the postgres linux user needs to initialize the replica node. (except for the systemctl commands)
  2. Shut down PostgreSQL (root) by entering the following command:
    systemctl stop postgresql-10
  3. Delete the data directory (as it will be cloned later on):
    1. cd /var/lib/pgsql/10/data
    2. rm -rdf *
  4. Clone the data from the primary (postgres user):
    1. su - postgres
    2. PGPASSWORD=<place postgres user password> /usr/pgsql-10/bin/repmgr -f /etc/repmgr/10/repmgr.conf -h <primary-ip> -U repuser -d postgres standby clone
    3. exit
  5. Start PostgreSQL (root):
    systemctl start postgresql-10
  6. Register the standby (postgres user):
    1. su - postgres
    2. /usr/pgsql-10/bin/repmgr -f /etc/repmgr/10/repmgr.conf standby register
    3. exit
  7. Make sure that the secondary was registered by running the following command:
    1. su - postgres
    2. /usr/pgsql-10/bin/repmgr -f /etc/repmgr/10/repmgr.conf cluster show
    3. exit
  8. Start repmgr10 Service (root) – on all nodes!
    1. systemctl enable repmgr10
    2. systemctl start repmgr10
    3. Validate the service is running by entering systemctl status repmgr10

Need more help with this?
Click here to open a Support ticket

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.