Upgrade

Major Upgrade

This example assumes you have run primary using a PG 9.5 or 9.6 image such as centos7-9.5.15-2.2.0 prior to running this upgrade.

Starting in release 1.3.1, the upgrade container will let you perform a pg_upgrade either from a PostgreSQL version 9.5 database to 9.6 or from 9.6 to 10.

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 9.5 to 9.6, make sure the variable references a PG 9.6 image such as centos7-9.6.11-2.2.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 ones relevant to your situation.

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.