Restoring your environment
Each environment in your disaster recovery plan contains different components to be restored.
About this task
Procedure
-
Prepare the environment that you want to use to restore your deployments with the backed-up
data.
- Install Red Hat OpenShift with the same version as your source environment. To install, see Installing Red Hat software.
- Install the FNCM operator by following the steps in Preparing your cluster to prepare and set up your environment.
- Create a project with the same name as your previous environment.
- Create the secure definition by using the backup secure definitions.
-
Restore the persistent volumes (PV) and persistent volume claims (PVC):
- If you are using static provisioning, restore your PVCs and PVs by using your backup definitions.
- If you are using dynamic provisioning, create the PVC for
cpe-filestore
,icn-cfgstore
, andcss-indexstore
.
- If you previously used Lightweight Directory Access Protocol (LDAP), restore the LDAP server. Different types of LDAP servers have different methods for restoring. For IBM Security Directory Server, see IBM Security Directory Server backup and restore. If you took a snapshot of the LDAP virtual machine in your previous environment, restore the snapshot.
-
Restore all the databases from the backup images. For example, if you are using PostgreSQL, restore the data by using
the database command
pg_restore
. If you are using Db2 with online backup, you can restore your databases by using the following commands:db2 restore database OSDB from '/home/db2inst1/backup/560/online' taken at 20211213191010 into OSDB replace existing db2 restore database GCDDB from '/home/db2inst1/backup/560/online' taken at 20211213191016 into GCDDB replace existing db2 restore database ICNDB from '/home/db2inst1/backup/560/online' taken at 20211213191024 into ICNDB replace existing db2 rollforward db OSDB to end of logs and stop db2 rollforward db GCDDB to end of logs and stop db2 rollforward db ICNDB to end of logs and stop
-
Restore the files stored on the PV. Keep the same folder structure, the same user group
information, and the same permissions. If you are using an NFS based storage, you can use the following script to restore PV content for PVCs such as
cpe-filestore
,css-indexstore
andicn-cfgstore
. The script does not restore log files. If you want to restore the log files, you need to copy the log files to the corresponding PV.#!/bin/sh NS=fncm SOURCE_DIR=/home/pv/560 TARGET_DIR=/home/pv/560 BACKUP_DIR=/home/backup pvrestore() { oc get pvc -n $NS --no-headers=true | while read each do pvc=`echo $each | awk '{ print $1 }'` pv=`echo $each | awk '{ print $3 }'` case $pvc in *"cpe-filestore"*) echo "restore $pvc" ;; *"icn-cfgstore"*) echo "restore $pvc" ;; *) continue ;; esac if [ -d "$BACKUP_DIR/$pvc" ] then echo " cp -r -a $BACKUP_DIR/$pvc/. $TARGET_DIR/$NS-$pvc-$pv/ " cp -r -a $BACKUP_DIR/$pvc/* $TARGET_DIR/$NS-$pvc-$pv/ else echo "NOT FOUND for $pvc" fi done } pvrestore
- If you are using an NFS based storage, modify the ownership of the files that you
restored in step 7.
- Check the ownership of the backup files, by running a command similar
to:
drwxr-x--- 3 1000650000 root 4096 Dec 13 18:13 fncm-cpe-filestore
- In your previous environment, check the
uid-range
in the namespace, by running the command:
The output looks similar to:oc describe project fncm
Name: fncm Created: 20 hours ago ... Annotations: ... ... openshift.io/sa.scc.supplemental-groups= 1000640000/10000 openshift.io/sa.scc.uid-range= 1000640000/10000
- For all restored files, modify the
uid
from100065000
to100064000
, by using the following command:find ./ -uid 1000650000 -exec chown 1000640000:root {} \;
- Check the ownership of the backup files, by running a command similar
to:
-
Prepare the custom resource (CR) definition for the restored environment.
- If the previous environment's hostname is different than the restored environment's hostname, change the hostname in the CR files to match the hostname of the restored environment.
- If initialization was completed in the original deployment, set the following values in your CR
to avoid reinitialization and verification that might cause an error in your database
data:
shared_configuration.sc_content_initialization: false shared_configuration.sc_content_verification: false
- Deploy the environment with the backup CR definition files.