0

I have a postgres active/standby cluster of 2 nodes, I have used repmgr for creating the cluster. The issue is, automatic failover is not happening when I stop the postgres services on master node. Contents of file repmgr.conf on master are as follows:

node_id=1
data_directory='/data/pgdatabase/masterdb/data'
node_name=node1
conninfo='host=IP-Of-Master user=repmgr dbname=repmgr'
failover=automatic
promote_command='repmgr standby promote -f /etc/repmgr/11/repmgr.conf --log-to-file'
follow_command='repmgr standby follow -f /etc/repmgr/11/repmgr.conf --log-to-file  --upstream-node-id=%n'
log_file='/var/log/repmgr/repmgr.log'
log_level=NOTICE
reconnect_attempts=4
reconnect_interval=5
repmgrd_service_start_command='sudo systemctl repmgr11 start'
repmgrd_service_stop_command='sudo systemctl repmgr11 stop'

Contents of postgresql.conf are as follows:

listen_addresses = '*'
shared_preload_libraries = 'repmgr'
max_wal_senders = 15
max_replication_slots = 15
wal_level = 'replica'
hot_standby = on
archive_mode = on
archive_command = 'cp %p /var/lib/pgsql/11/archive/%f'

The contents are same on master and slave expect the name, which is node2 on slave. Can anyone guide me what can be possible reason for automatic failover not happening

1 Answers1

0

I have resolved it myself, I needed to create file /etc/default/repmgrd and add following lines into it

REPMGRD_ENABLED=yes
REPMGRD_CONF="/etc/repmgr.conf"
  • There is yet some issue. When node 1 is primary and node 2 is slave, on switchover, node 2 becomes primary. But when node 2 is primary but node 1 is slave, node 1 does not promote to primary – makhshif afiniti May 03 '20 at 15:07