1. Open the file using the command:
    vi /etc/repmgr/10/repmgr.conf
  2. In the file, make the following changes: Remove the # signs before the configuration headers for them to become active.
Configuration Description
node_id = 1 This needs to be a unique numeric identifier across the cluster greater than 0— for the primary, we have used 1.
node_name = ‘N1’ This needs to be a unique (text and/or numerals) identifier across the cluster— for the primary, we have used N1.
conninfo = ‘host=LOCALIP port=5432 user=repuser dbname=postgres password={repuser_user_Password_Here}’ Replace LOCALIP with the server IP .This provides the connection info to this node to all replicas across the replication cluster. This determines the data directory—used for command line usage (such as pg_ctl etc.).
data_directory = ‘/var/lib/pgsql/10/data’ Tells REPMGR where the data directory is located at.
replication_type = ‘physical’ (IN the latest REPMGR there is a possibility of a bug, so leave this with # as it is.) Determines that streaming replication will be used.
use_replication_slots = yes Makes REPMGR create and use replication slots— allows the failed over node to rejoin as slave and have the delta.
pg_bindir = ‘/usr/pgsql-10/bin’ Required for running command line tools from PostgreSQL’s binary folder.
failover = ‘automatic’ Determines if the failover should be automatic or manual.
promote_command = '/usr/pgsql-10/bin/repmgr standby promote -f /etc/repmgr/10/repmgr.conf --log-to-file' Determines the action taken when this node should become a primary.
follow_command = '/usr/pgsql-10/bin/repmgr standby follow -f /etc/repmgr/10/repmgr.conf --log-to-file --upstream-node-id=%n' Determines the action taken when this node should become a replica and follow the new primary.
monitoring_history = yes Logs information about the activity in the replication cluster.
monitor_interval_secs = 10 The interval for monitoring logins.
service_start_command = ‘sudo systemctl start postgresql-10’ The start command for PostgreSQL service.
service_stop_command = ‘sudo systemctl stop postgresql-10’ The stop command for PostgreSQL service.
service_restart_command = ‘sudo systemctl restart postgresql-10’ The restart command for PostgreSQL service.
service_reload_command = ‘sudo systemctl reload postgresql-10’ The reload command for PostgreSQL service.
  1. After changing the above configurations, initialize the primary node. This should be done by the Linux user postgres using the following commands:
    su - postgres

/usr/pgsql-10/bin/repmgr -f /etc/repmgr/10/repmgr.conf master register

exit

  1. Once this is completed, reboot the server using the command:
    sudo reboot
  1. Make sure that the primary node was registered by running the following commands:
    su - postgres

/usr/pgsql-10/bin/repmgr -f /etc/repmgr/10/repmgr.conf cluster show

Once this is completed, you will need to configure REPMGR on the secondary (replica) node.

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.