Example: Setting up Db2 Warehouse HADR in multiple OpenShift clusters
Upgrade to IBM Software Hub Version 5.1 before IBM Cloud Pak for Data Version 4.6 reaches end of support. For more information, see Upgrading IBM Software Hub in the IBM Software Hub Version 5.1 documentation.
This example has one primary and one principal standby in the same OpenShift project within the same cluster, and one auxiliary standby in a different OpenShift cluster (disaster site).
By using Determining the Db2 Warehouse NodePorts for a multiple cluster configuration, the ports for each database in the example are:
- Primary: 32457
- Standby: 31384
- Aux1: 32649
To set up HADR for databases that are in different OpenShift clusters:
- Run the following command to invoke the
setup_config_hadrscript on the primary database Db2 Warehouse pod:oc exec -it c-db2wh-primary-db2u-0 -- setup_config_hadr --db-role primary --primary-name db2wh-primary --standby-name db2wh-standby --primary-port 32457 --standby-port 31384 --aux1-name db2wh-aux --aux1-port 32649 --etcd-host my-etcd-client.my-etcd --etcd-port 2379 --multiclusterThe output of the command contains the HADR configuration settings:
################################################################################ ### Creating HADR configuration file for HADR setup. ### ################################################################################ Database role -- primary primary database formation_id -- db2wh-primary HADR_REMOTE_INST db2inst1 HADR_TIMEOUT 120 HADR_SYNCMODE NEARSYNC HADR_PEER_WINDOW 120 LOGINDEXBUILD ON HADR_LOCAL_HOST c-db2wh-primary-db2u-0|c-db2wh-standby-hadr-svc-ext HADR_LOCAL_SVC 60006|32457 HADR_REMOTE_HOST c-db2wh-standby-hadr-svc-ext HADR_REMOTE_SVC 31384 HADR_TARGET_LIST c-db2wh-standby-hadr-svc-ext:31384|c-db2wh-aux-hadr-svc-ext:32649 etcd: my-etcd-client.my-etcd:2379If the setup is successful, the following message displays at the end of the script output:
################################################################################ ### The HADR setup command completed the primary node setup. ### ################################################################################ - Copy the database backup image and keystore file in the backup storage area
(/mnt/backup/) from the primary database to the standby databases by using
rsync. An extra step is required here to copy from Cluster1 (where the primary database is located)
to Cluster2 (where the auxiliary standby database is
located).
# Copy from primary database to a directory on the host called /tmp/hadr oc rsync c-db2wh-primary-db2u-0:/mnt/backup/ /tmp/hadr # Copy from the /tmp/hadr directory on the host to the principal standby database oc rsync /tmp/hadr/ c-db2wh-standby-db2u-0:/mnt/backup/ # After copying /tmp/hadr/ from Cluster1 to Cluster2 oc rsync /tmp/hadr/ c-db2wh-aux-db2u-0:/mnt/backup/ - Run the following command to invoke the
setup_config_hadrscript on the principal standby database Db2 Warehouse pod:oc exec -it c-db2wh-standby-db2u-0 -- setup_config_hadr --db-role standby --primary-name db2wh-primary --standby-name db2wh-standby --primary-port 32457 --standby-port 31384 --aux1-name db2wh-aux --aux1-port 32649 --etcd-host my-etcd-client.my-etcd --etcd-port 2379 --multiclusterThe output of the command:
################################################################################ ### Creating HADR configuration file for HADR setup. ### ################################################################################ Database role -- standby primary database formation_id -- db2wh-standby HADR_REMOTE_INST db2inst1 HADR_TIMEOUT 120 HADR_SYNCMODE NEARSYNC HADR_PEER_WINDOW 120 LOGINDEXBUILD ON HADR_LOCAL_HOST c-db2wh-standby-db2u-0|c-db2wh-primary-hadr-svc-ext HADR_LOCAL_SVC 60007|31384 HADR_REMOTE_HOST c-db2wh-primary-hadr-svc-ext HADR_REMOTE_SVC 32457 HADR_TARGET_LIST c-db2wh-primary -hadr-svc-ext:32457|c-db2wh-aux-hadr-svc-ext:32649 etcd: my-etcd-client.my-etcd:2379 - Run the following command to invoke the
setup_config_hadrscript on the auxiliary standby database Db2 Warehouse pod:oc exec -it c-db2wh-aux-db2u-0 -- setup_config_hadr --db-role aux1 --primary-name db2wh-primary --standby-name db2wh-standby --primary-port 32457 --standby-port 31384 --aux1-name db2wh-aux --aux1-port 32649 --etcd-host my-etcd-client.my-etcd --etcd-port 2379 --multiclusterThe output of the command:
################################################################################ ### Creating HADR configuration file for HADR setup. ### ################################################################################ Database role -- aux1 primary database formation_id -- db2wh-aux HADR_REMOTE_INST db2inst1 HADR_TIMEOUT 120 HADR_SYNCMODE NEARSYNC HADR_PEER_WINDOW 120 LOGINDEXBUILD ON HADR_LOCAL_HOST c-db2wh-aux-db2u-0|c-db2wh-aux-hadr-svc-ext HADR_LOCAL_SVC 60008|32649 HADR_REMOTE_HOST c-db2wh-primary-hadr-svc-ext HADR_REMOTE_SVC 32457 HADR_TARGET_LIST c-db2wh-standby-hadr-svc-ext:31384|c-db2wh-primary-hadr-svc-ext:32457 etcd: my-etcd-client.my-etcd:2379