REPMGR supports automatic failover. In a case of a failover – we need to “REJOIN” the fallen node to the cluster manually with the following commands:

sudo su - systemctl stop postgresql-10 su  postgres cd ~ PGPASSWORD=<postgres user password> /usr/pgsql-10/bin/repmgr -f /etc/repmgr/10/repmgr.conf -h <new primary ip> -U repuser -d postgres standby clone --force-rewind --force exit systemctl start postgresql-10 su postgres /usr/pgsql-10/bin/repmgr standby register --force

Troubleshooting:
If the failover does not work use the following command on the standby DB machine:

  1. su - postgres
  2. /usr/pgsql-10/bin/repmgr standby promote