Upgrade

Major Upgrade

This example assumes you have run primary using a PostgreSQL 12 or 13 image such as ubi8-13.7-0 prior to running this upgrade.

The upgrade container will let you perform a pg_upgrade from PostgreSQL version 11, 12, 13 or 14 to any higher version, up to and including version 15. It does not do multi-version upgrades so you will need to for example do a 11 to 12 and then a 12 to 13 to get to version 13.

Prior to running this example, make sure your CCP_IMAGE_TAG environment variable is using the next major version of PostgreSQL that you want to upgrade to. For example, if you’re upgrading from 12 to 13, make sure the variable references a PostgreSQL 13 image such as ubi8-13.7-0.

This will create the following in your Kubernetes environment:

  • a Kubernetes Job running the crunchy-upgrade container
  • a new data directory name upgrade found in the pgnewdata PVC
Data checksums on the Crunchy PostgreSQL container were enabled by default in version 2.1.0. When trying to upgrade, it’s required that both the old database and the new database have the same data checksums setting. Prior to upgrade, check if data_checksums were enabled on the database by running the following SQL: SHOW data_checksums

Kubernetes and OpenShift

Before running the example, ensure you edit upgrade.json and update the OLD_VERSION and NEW_VERSION parameters to the major release version relevant to your situation.

First, delete the existing primary deployment:

${CCP_CLI} delete deployment primary

Then start the upgrade as follows:

cd $CCPROOT/examples/kube/upgrade
./run.sh

If successful, the Job will end with a successful status. Verify the results of the Job by examining the Job’s pod log:

${CCP_CLI} get pod -l job-name=upgrade
${CCP_CLI} logs -l job-name=upgrade

You can verify the upgraded database by running the post-upgrade.sh script in the examples/kube/upgrade directory. This will create a PostgreSQL pod that mounts the upgraded volume.