Shutting down the Postgres database
Shut down the Postgres database to ensure no changes are made to the database during migration.
Instructions:
- Shutting down Postgres database in Management subsystem on Kubernetes or VMware
- Shutting down Postgres database in Management subsystem on OpenShift
Shutting down Postgres database in Management subsystem on Kubernetes or VMware
When using s3 backup configuration for the Management subsystem, the following steps should be run on the source system, before the target API Connect system is installed.
- If on a VMware appliance deployment, connect to the Management node and log in as root user
(
sudo -i
), so that you can runkubectl
. - Enable pgo
client:
kubectl set env deploy/ibm-apiconnect ENABLE_PGO_CLIENT="true" -n OPERATOR_NAMESPACE
- Wait for
pgo-client
pod to come up. - Bring down the apic
operator:
kubectl scale deploy ibm-apiconnect --replicas=0 -n OPERATOR_NAMESPACE
- Scale down deployments.Before scaling down the deployments, make a note of the current replicas:
kubectl get deployment -n namespace
- Standard deployments :
- juhu
- portal-proxy
- apim
- lur
- taskmanager
- hub (when Test and Monitor is enabled)
- Scale
down:
kubectl scale deploy <deployment_name> --replicas=0 -n NAMESPACE
- To get the name of the Postgres
cluster:
kubectl get pgcluster -n NAMESPACE
- Connect to pgo client pod and
run:
pgo update cluster PG_CLUSTER_NAME --shutdown -n NAMEPSACE
- Standard deployments :
Shutting down Postgres database in Management subsystem on OpenShift
When using s3 configuration, the following steps should be run on the source system, before the target API Connect system is installed.
- Change to operator namespace:
oc project "{OPERATOR NS}"
oc edit csv ibm-apiconnect.v2.4.0
- Search for
APPLIANCE
and add these two lines above it:- name: ENABLE_PGO_CLIENT value: "true"
- Save and wait for the pgo-client pod to come up.
- Search for
oc scale deploy ibm-apiconnect --replicas=0
- Bring down apiconnect operator pod:
oc scale deploy ibm-apiconnect --replicas=0
- Change to the namespace where API Connect is installed:
oc project "{APIC NS}"
- Scale down the following deployments: juhu, portal-proxy, apim, lur, taskmanager
oc scale deploy JUHU_DEPLOYMENT_NAME --replicas=0 oc scale deploy PORTAL_PROXY_DEPLOYMENT_NAME --replicas=0 oc scale deploy APIM_DEPLOYMENT_NAME --replicas=0 oc scale deploy LUR_DEPLOYMENT_NAME --replicas=0 oc scale deploy TASKMANAGER_DEPLOYMENT_NAME --replicas=0
- To get the name of the pg cluster:
oc get pgcluster
- Log in to pgo client pod:
oc exec -it $(oc get po|grep pgo|awk '{print $1}') -- bash
- Shutdown Postgres
database:
pgo update cluster PG_CLUSTER_NAME --shutdown -n NAMESPACE
Starting the Postgres database in the Management subsystem on Kubernetes and OVA
Use these steps when you are moving back to the source system because the migration failed, and you want to bring up the Postgres database, if it was shutdown.
- If on an appliance (VMware), connect to the Management node and log in as root user
(
sudo -i
), so that you can run thekubectl
commands. - Get the name of the Postgres cluster:
kubectl get pgcluster -n NAMESPACE
- Connect to the pgo client pod and run the
command:
pgo update cluster PG_CLUSTER_NAME --startup -n NAMESPACE
- Scale up the deployments that use Postgres.
Standard deployments : juhu, portal-proxy, apim, lur, taskmanager, hub (when test and monitor is enabled)
kubectl scale deploy DEPLOYMENT_NAME --replicas=N -n NAMEPSACE
The value of
N
is from thekubectl get deployment -n namespace
output that you got before shutting down the Postgres database. It is 1 if using n1 profile, and 3 when using n3 profile. - Bring up the apic
operator:
kubectl scale deploy ibm-apiconnect --replicas=1 -n OPERATOR_NAMESPACE
- If s3 backups are used, perform a Management restore with the backup that was taken as part of
Preparing the source system.Note: Any backups that are taken on the target system are not valid for the source system. The backups must not be used during restoration.
- Ensure that all subsystems are healthy.
Starting postgres database on the Management subsystem on OpenShift
Use these steps when you are moving back to the source system because the migration failed, and you want to bring up the Postgres database, if it was shutdown.
- Change to the project where the top-level CR (apic) is
installed:
oc project APIC_NAMESPACE
- Get the name of the Postgres cluster:
oc get pgcluster
- Log in to pgo client
pod:
oc exec -it $(oc get po|grep pgo|awk '{print $1}') -- bash
- Start the postgres
database:
pgo update cluster PG_CLUSTER_NAME --startup -n NAMESPACE
- Scale up the deployments: juhu, portal-proxy, apim, lur, and taskmanager. Use the following
commands, where
N
is the value of replicas. If an n1 profile being used the value is 1, and if an n3 profile is being used the value is 3.oc scale deploy JUHU_DEPLOYMENT_NAME --replicas=N
oc scale deploy PORTAL_PROXY_DEPLOYMENT_NAME --replicas=N
oc scale deploy APIM_DEPLOYMENT_NAME --replicas=N
oc scale deploy LUR_DEPLOYMENT_NAME --replicas=N
oc scale deploy TASKMANAGER_DEPLOYMENT_NAME --replicas=N
- Bring down the apiconnect operator
pod:
oc scale deploy ibm-apiconnect --replicas=1 -n OPERATOR_NAMESPACE
- If s3 backups are used, perform a Management restore with the backup that was taken as part of
Preparing the source system.Note: Any backups that are taken on the target system are not valid for the source system. The backups must not be used during restoration.
- Ensure that all subsystems are healthy.