For this scenario, assume that we have two servers with the addresses of 192.168.1.10 and 192.168.1.20, where 192.168.1.10 is currently the primary server. In addition, we have a virtual IP address of 192.168.1.30 on the eth0 Ethernet device. To upgrade the PostgreSQL software on both nodes, follow these steps:
- Stop the database copy on 192.168.1.20 as the postgres user using this command:
pg_ctl -D /path/to/database stop -m fast
- Perform any necessary software upgrades. For example, to upgrade a Debian or Ubuntu server to the latest PostgreSQL 12, use the following command as a root-capable user on 192.168.1.20:
sudo apt-get install postgresql-12
- Start the database copy on 192.168.1.20 as the postgres user:
pg_ctl -D ...