Search code examples
postgresqlreplication

Postgresql Replication fail over scenario - not able to bring back old primary as slave


I am facing issue while making old primary to standby after 1st fail over.

1st time slave has switched to master and when old master comes back it is still acting as primary.

I am using repmgr.


Solution

  • First, you need to check if the slave is properly promoted to master by using

    $ repmgr -f /etc/repmgr.conf cluster show
    

    If it is not promoted, then please use

    $ repmgr -f /etc/repmgr.conf standby promote
    

    And when the old master comes back and still acting as primary, then use the switchover command (must be run from the standby which is to be promoted)

    $ repmgr -f /etc/repmgr.conf standby switchover