Configure REPMGR (primary node)
This needs to be carried out on the primary node. Note that the commands executed are different in the primary node than the secondary.
-
Configure the REPMGR configuration file (default located on
“/etc/repmgr/10/repmgr.conf”) by changing the configuration as
follows:
(Remove comments # in the file)node_id = 1 node_name = 'N1' 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' 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'
Note that you can find the the configuration parameters description here:
https://raw.githubusercontent.com/2ndQuadrant/repmgr/master/repmgr.conf.sample -
After changing the above configurations, the linux postgres user needs to
initialize the primary node.
-
su - postgres
-
/usr/pgsql-10/bin/repmgr -f /etc/repmgr/10/repmgr.conf primary register
-
Make sure that the primary was registered by running the following
command:
/usr/pgsql-10/bin/repmgr -f /etc/repmgr/10/repmgr.conf cluster show
-