Upgrading EDB Postgres from Version 4.7 to Version 5.0
An instance administrator can upgrade EDB Postgres from Cloud Pak for Data Version 4.7 to Version 5.0.
- Who needs to complete this task?
-
Instance administrator To upgrade EDB Postgres, you must be an instance administrator. An instance administrator has permission to manage software in the following projects:
- The operators project for the instance
-
The operators for this instance of EDB Postgres are installed in the operators project. In the upgrade commands, the
${PROJECT_CPD_INST_OPERATORS}environment variable refers to the operators project. - The operands project for the instance
-
The custom resources for the control plane and EDB Postgres are installed in the operands project. In the upgrade commands, the
${PROJECT_CPD_INST_OPERANDS}environment variable refers to the operands project.
- When do you need to complete this task?
-
Review the following options to determine whether you need to complete this task:
- If you want to upgrade the control plane and one or more services at the same time, follow the process in Upgrading an instance of Cloud Pak for Data instead.
- If you didn't upgrade EDB
Postgres when you upgraded the control plane, complete this task to upgrade EDB
Postgres.
Repeat as needed If you are responsible for multiple instances of Cloud Pak for Data, you can repeat this task to upgrade more instances of EDB Postgres on the cluster.
Information you need to complete this task
Review the following information before you upgrade EDB Postgres:
- Version requirements
-
All the components that are associated with an instance of Cloud Pak for Data must be installed at the same release. For example, if the Cloud Pak for Data control plane is at Version 5.0.3, you must upgrade EDB Postgres to Version 5.0.3.
- Environment variables
- The commands in this task use environment variables so that you can run the commands exactly as
written.
- If you don't have the script that defines the environment variables, see Setting up installation environment variables.
- To use the environment variables from the script, you must source the environment variables
before you run the commands in this task. For example,
run:
source ./cpd_vars.sh
- Storage requirements
- You don't need to specify storage when you upgrade EDB Postgres.
Before you begin
This task assumes that the following prerequisites are met:
| Prerequisite | Where to find more information |
|---|---|
| The cluster meets the minimum requirements for EDB Postgres. | If this task is not complete, see System requirements. |
The workstation from which you will run the upgrade is set up as a client workstation and
has the following command-line interfaces:
|
If this task is not complete, see Updating client workstations. |
| The Cloud Pak for Data control plane is upgraded. | If this task is not complete, see Upgrading an instance of Cloud Pak for Data. |
| For environments that use a private container registry, such as air-gapped environments, the EDB Postgres software images are mirrored to the private container registry. | If this task is not complete, see Mirroring images to a private container registry. |
For environments that use a private container registry, such as air-gapped environments,
the cpd-cli is configured to pull the olm-utils-v3 image from the private container registry. |
If this task is not complete, see Pulling the olm-utils-v2 image from the private container registry. |
Procedure
Complete the following tasks to upgrade EDB Postgres:
Preparing to upgrade service instances to a newer version of PostgreSQL
Before you upgrade EDB Postgres, ensure that the PostgreSQL clusters associated with the service are configured to pickup any new features that are available in newer versions of PostgreSQL.
- Get the list of EDB
Postgres service
instances:
oc get CPDEdbInstance \ --namespace=${PROJECT_CPD_INST_OPERANDS} - Get the list of PostgreSQL
clusters:
oc get clusters.postgresql.k8s.enterprisedb.io \ -n ${PROJECT_CPD_INST_OPERATORS} - For each service instance returned by the
oc get CPDEdbInstancecommand, identify the corresponding PostgreSQL clusters.For example, if you have two EDB Postgres service instances named:na-salesap-sales
The corresponding PostgreSQL clusters would be named:na-sales-edb-dbap-sales-edb-db
- For each PostgreSQL cluster associated
with an EDB
Postgres service instance:
- Set the
CLUSTER_NAMEenvironment variable to the name of a PostgreSQL cluster associated with a service instanceexport CLUSTER_NAME=<cluster-name> - Check the value of the
primaryUpdateMethodparameter:oc get clusters.postgresql.k8s.enterprisedb.io ${CLUSTER_NAME} \ -n ${PROJECT_CPD_INST_OPERATORS} \ -o json | jq -r '.spec.primaryUpdateMethod'- If the value is
switchoverproceed to the next step. - If the value is
restart, patch the cluster to changeprimaryUpdateMethodtoswitchover:oc patch cluster.postgresql.k8s.enterprisedb.io ${CLUSTER_NAME} \ --namespace ${PROJECT_CPD_INST_OPERATORS} \ --type=merge \ --patch '{ "spec": {"primaryUpdateMethod": "switchover"}}'
- If the value is
- Check the value of the
enableSuperuserAccessparameter:oc get clusters.postgresql.k8s.enterprisedb.io ${CLUSTER_NAME} \ -n ${PROJECT_CPD_INST_OPERATORS} \ -o json | jq -r '.spec.enableSuperuserAccess'- If the value is
trueproceed to the next step. - If the value is
false, patch the cluster to changeenableSuperuserAccesstotrue:oc patch cluster.postgresql.k8s.enterprisedb.io <cluster-name> \ --namespace ${PROJECT_CPD_INST_OPERATORS} \ --type=merge \ --patch '{ "spec": {"enableSuperuserAccess": true}}'
- If the value is
- Check the value of the
logLevelparameter:oc get clusters.postgresql.k8s.enterprisedb.io ${CLUSTER_NAME} \ -n ${PROJECT_CPD_INST_OPERATORS} \ -o json | jq -r '.spec.logLevel'- If the value is
infoproceed to Upgrading the service. - If the value is anything other than
info, patch the cluster to changelogLeveltoinfo:oc patch cluster.postgresql.k8s.enterprisedb.io <cluster-name> \ --namespace ${PROJECT_CPD_INST_OPERATORS} \ --type=merge \ --patch '{ "spec": {"logLeve": "info"}}'
- If the value is
- Set the
Upgrading the service
cpd-cli
manage
apply-olm updates all of the OLM objects in the operators project
at the same time.To upgrade EDB Postgres:
-
Log the
cpd-cliin to the Red Hat® OpenShift Container Platform cluster:${CPDM_OC_LOGIN}Remember:CPDM_OC_LOGINis an alias for thecpd-cli manage login-to-ocpcommand. - Update the custom resource for EDB
Postgres.
cpd-cli manage apply-cr \ --components=edb_cp4d \ --release=${VERSION} \ --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \ --license_acceptance=true \ --upgrade=true
Validating the upgrade
apply-cr command
returns:[SUCCESS]... The apply-cr command ran successfully
If you want to confirm that the custom resource status is
Completed, you can run the cpd-cli
manage
get-cr-status command:
cpd-cli manage get-cr-status \
--cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
--components=edb_cp4d
Upgrading existing service instances
To upgrade the service instances:
-
Log in to Red Hat OpenShift Container Platform as an instance administrator.
${OC_LOGIN}Remember:OC_LOGINis an alias for theoc logincommand. - Get the list of EDB
Postgres service
instances:
oc get CPDEdbInstance \ --namespace=${PROJECT_CPD_INST_OPERANDS} - Set the
INSTANCE_NAMEenvironment variable to the name of the service instance that you want to upgrade:export INSTANCE_NAME=<instance-name> - Set the
INSTANCE_VERSIONenvironment variable to the version that corresponds to the version of Cloud Pak for Data on your cluster:export INSTANCE_VERSION=<version>Use the following table to determine the appropriate value:
Cloud Pak for Data version Add-on version Service instance versions (Pick one)5.0.3 5.0.3 12.20, 13.16, 14.13, 15.8, 16.4 5.0.2 5.0.2 12.19, 13.15, 14.12, 15.7, 16.3 5.0.1 1.0.0.0 12.19, 13.15, 14.12, 15.7, 16.3 5.0.0 1.0.0.0 12.18, 13.14, 14.11, 15.6, 16.2 - Update the version in the service instance custom
resource:
oc patch CPDEdbInstance ${INSTANCE_NAME} \ --namespace=${PROJECT_CPD_INST_OPERANDS} \ --type=merge \ --patch="{\"spec\": {\"version\": \"${INSTANCE_VERSION}\"}}" - Repeat the preceding steps to upgrade each service instance in the operands project.
What to do next
Your existing EDB Postgres database instances are ready to use. See Post-installation setup for the EDB Postgres service for more information.