Disable automatic failover
In order to disable automatic failover, run the following command as user postgres:
/usr/pgsql-14/bin/repmgr service pauseCommon setup for all nodes
Install postgres and repmgr version 17 and enable them:
dnf install -y postgresql17-server repmgr_17
systemctl enable postgresql-17
systemctl enable repmgr-17Create repmgr.conf from the old one:
cp -f /etc/repmgr/14/repmgr.conf /etc/repmgr/17/repmgr.conf
sed -i s#/var/lib/pgsql/14/data/#/var/lib/pgsql/17/data/# /etc/repmgr/17/repmgr.conf
sed -i s#/usr/pgsql-14/bin/#/usr/pgsql-17/bin/# /etc/repmgr/17/repmgr.conf
sed -i s#/etc/repmgr/14/repmgr.conf#/etc/repmgr/17/repmgr.conf# /etc/repmgr/17/repmgr.conf
sed -i s#/run/repmgr/repmgrd-14.pid#/run/repmgr/repmgrd-17.pid# /etc/repmgr/17/repmgr.conf
sed -i s#postgresql-14#postgresql-17# /etc/repmgr/17/repmgr.confFirst step: master EM
Set up directories for the new postgres installation:
/usr/pgsql-17/bin/postgresql-17-setup initdbStop old version of postgres:
systemctl stop postgresql-14
systemctl disable postgresql-14Upgrade postgres database (run as postgres user):
/usr/pgsql-17/bin/pg_upgrade --old-bindir=/usr/pgsql-14/bin/ --new-bindir=/usr/pgsql-17/bin/ --old-datadir=/var/lib/pgsql/14/data/ --new-datadir=/var/lib/pgsql/17/data/Copy postgres configuration files to new location:
cp /var/lib/pgsql/14/data/pg_hba.conf /var/lib/pgsql/17/data/pg_hba.conf
cp /var/lib/pgsql/14/data/postgresql.conf /var/lib/pgsql/17/data/postgresql.confStart new postgres services:
systemctl start postgresql-17
systemctl start repmgr-17Next steps
Update postgres on remaining nodes starting from standby EM and then CPs/MPs one-by-one.
Stop old version of postgres:
systemctl stop postgresql-14
systemctl disable postgresql-14Clone the database (run as postgres user):
/usr/pgsql-17/bin/repmgr -h <master address> -U repmgr -d repmgr standby cloneStart new version of postgres:
systemctl start postgresql-17Register standby server (run as postgres user):
/usr/pgsql-17/bin/repmgr -h <master address> -U repmgr -d repmgr standby register --forceEnable automatic failover
Re-enable automatic failover if needed:
/usr/pgsql-17/bin/repmgr service unpauseRemove old postgres
After validating the new postgres installation, you can remove the old postgres binaries and data directory:
yum remove postgresql14-libs postgresql14 postgresql14-server repmgr_14
rm -rf /var/lib/pgsql/14/data