Move both Postgres and PGD to a new minor version at the same time, using one of three approaches:
full downtime, a rolling upgrade in
place, or a rolling upgrade that replaces
nodes. Moving both Postgres and PGD to a new minor version at
the same time means upgrading each node in
place rather than replacing it:
installing the new PGD packages built for your Postgres version also picks up the latest available Postgres
minor version for it, so a single package install and restart covers both. No new data directory,
pg_upgrade, or node join is needed, since neither a PGD nor a Postgres minor version upgrade changes the
on-disk format.
Upgrading with full downtime
Choose this approach when a maintenance window is acceptable and finishing quickly matters more than staying online. See Choosing between a rolling and full-downtime upgrade for the trade-offs against the two rolling approaches described below.
Stop Postgres on every node:
sudo systemctl stop postgresYou can run this step one node at a time, but you must wait for each node to shut down cleanly before moving to the next. Monitor progress with
sudo journalctl -u postgres -f.Install the new combined PGD and Postgres packages for your Postgres version on every node, for example:
sudo apt install edb-pgd6-expanded-pg<postgres_version>
Start Postgres on every node:
systemctl start postgres
Both PGD and Postgres upgrade to the new version on start.
Confirm the new versions took effect on every node:
SELECT bdr.bdr_version(); SHOW server_version;
Check
pgd nodes listfor overall cluster health.
Upgrading with a rolling upgrade, in place
For each node, one at a time:
Fence the node, so it can't become the write leader until the upgrade is complete:
pgd node <node_name> set-option route_fence true
Stop Postgres:
sudo systemctl stop postgresMonitor progress with
sudo journalctl -u postgres -f.Install the new combined PGD and Postgres packages for your Postgres version, for example:
sudo apt install edb-pgd6-expanded-pg<postgres_version>
Start Postgres. Both PGD and Postgres upgrade to the new version on start:
systemctl start postgres
Unfence the node, then confirm it's healthy before moving to the next one:
pgd node <node_name> set-option route_fence false
Confirm the new versions took effect on the node:
SELECT bdr.bdr_version(); SHOW server_version;
Check your monitoring as usual after upgrading a node.
Note
Sometimes more steps, like reindexing, are recommended for specific minor version upgrades. Refer to the release notes of the version of Postgres you're upgrading to.
Upgrading with a rolling upgrade, by replacing nodes
Instead of upgrading a node in place, join a new node that already has the new combined PGD and Postgres minor versions installed, then part and drop one of the existing nodes. Use this approach if you're also replacing hardware or a base image at the same time as the minor version bump.
Provision a new node with the new combined PGD and Postgres minor version packages already installed.
Join the new node to the cluster using a logical join:
pgd node <node_name> setup --dsn "<new_node_dsn>" --cluster-dsn "<existing_node_dsn>" -D <pg_data>
Don't use
bdr_init_physical, it requires the source and joining node to run the same PGD version, so it can't be used across a version change. See thepgd node setupcommand reference for the full set of options.Wait for the new node to catch up with the cluster before routing traffic to it, then confirm it's healthy:
pgd nodes list
Update your application's connection configuration to include the new node once it's ready to take traffic.
Part one of the existing nodes, then decommission it:
pgd node <node_name> part
Repeat for each remaining node, one at a time, until the whole cluster is on the new version.