For the purposes of this recipe, pg-primary will remain our master node, and the replica will be pg-clone. As always, the /db/pgdata path will be our default data directory.
Follow these steps to promote pg-clone to be the new cluster master:
- Stop the PostgreSQL service on the pg-primary node with pg_ctl:
pg_ctl -D /db/pgdata stop -m fast
- As the postgres user on pg-clone, execute this command to promote it from standby status to primary:
repmgr -f /etc/repmgr.conf standby promote
- View the status of the cluster with this command as postgres on pg-clone:
repmgr -f /etc/repmgr.conf cluster show
Follow these steps to rebuild pg-primary (while logged into pg-primary) to be the new cluster standby:
- Erase the contents ...