Replication from Db2 Warehouse on Red Hat Openshift and Kubernetes to Db2 Warehouse Common Container
You can configure the replication functionality from Db2 Warehouse on Red Hat Openshift and Kubernetes or Cloud Pak for Data to Db2 Warehouse Common Container.
Before you begin
- Db2 Warehouse common Container version 11.5.9-cn1 or later.
- Db2 Warehouse on Red Hat Openshift and Kubernetes version s11.5.9.0-cn3 or later.
- Cloud Pak for Data version 5.0.3 or later.
Procedure
- Enable the replication functionality and configure Db2 Warehouse on Red Hat Openshift and Kubernetes or Cloud Pak for Data environment. This is your source site. For more information, see Managing replication using shell scripts.
- Enable the Q replication license and configure the Db2 Warehouse common container environment. This is your target site, Follow the instructions from Step 1 to Step 2 in Replication from Db2 Warehouse Common Container to Db2 Warehouse on Red Hat Openshift and Kubernetes.
- Generate and upload console SSL certificates on your target site.
- After enabling replication on your target site, check the values
for LOCAL_CLUSTER_INFRA_HOSTNAME and LOCAL_DB2_HOSTNAME
parameters in the $BLUDR_SHARED_DIR/settings_backup/server.env file and
ASN.IBMQREP_RESTAPI_PROPERTIES
properties table:- For the $BLUDR_SHARED_DIR/settings_backup/server.env file:
grep "LOCAL_CLUSTER_INFRA_HOSTNAME" $BLUDR_SHARED_DIR/settings_backup/server.env grep "LOCAL_DB2_HOSTNAME" $BLUDR_SHARED_DIR/settings_backup/server.env
If the value does not appear as expected, update it to your desired value:sed -i 's/^LOCAL_CLUSTER_INFRA_HOSTNAME=incorrect.servername.abc.com/LOCAL_CLUSTER_INFRA_HOSTNAME=correct.servername.abc.com/' "$BLUDR_SHARED_DIR/settings_backup/server.env ; sed -i 's/^LOCAL_DB2_HOSTNAME=incorrect.servername.abc.com/LOCAL_DB2_HOSTNAME=correct.servername.abc.com/' "$BLUDR_SHARED_DIR/settings_backup/server.env ;
To retrieve the hostname, run the following command:hostname -A | awk '{print $NF}'
- For the
ASN.IBMQREP_RESTAPI_PROPERTIES
properties table:db2 connect to BLUDB db2 "select * from ASN.IBMQREP_RESTAPI_PROPERTIES where PROP_KEY in ('LOCAL_CLUSTER_INFRA_HOSTNAME' , 'LOCAL_DB2_HOSTNAME' ) "
If the value does not appear as expected, update it to your desired value:db2 "update ASN.IBMQREP_RESTAPI_PROPERTIES set PROP_VALUE_CHAR = 'server.abc.com' where PROP_KEY in ('LOCAL_CLUSTER_INFRA_HOSTNAME' , 'LOCAL_DB2_HOSTNAME' )
Commit your changes:db2 "commit"
For the changes to take effect, you must restart theBludr
server. Run the following script:$BLUDR_HOME/scripts/bin/bludr-restart.sh;
- For the $BLUDR_SHARED_DIR/settings_backup/server.env file:
- On your Db2 Warehouse common container target site, run the following SQL query:
db2 "update ASN.IBMQREP_RESTAPI_PROPERTIES set PROP_VALUE_CHAR = 'DB2U-DB2WH-PVT-CC' where PROP_KEY = 'LOCAL_DR_ENV_TYPE' "
- Enable the Q replication add on functionality on your source site. Follow the instructions from Step 1 to Step 3 in Configuring replication using shell scripts.
- Add the target site to your source site. Run the
bludr-perform-target-actions.sh
script and select option 3.Note: To add the destination site, following information is required:- Target Infra/Bastion hostname
- Target REST external Port
- Target database hostname
- Target external database SSL Port
- Target database name
- Target database replication user
- Target database replication password
- Target data replication environment
When selecting the target data replication, you have the following options:
- IIAS for Sailfish/IIAS Environment.
- DB2WH for Db2 Warehouse private Environment
- DB2WOC for Db2 Warehouse on Cloud Generation 2
- DB2U-DB2OLTP for Cloud Pak for Data Db2 Universal Db2 Online Transaction Processing
- DB2U-DB2WH for Cloud Pak for Data Db2 Universal Db2 Warehouse
- DB2U-SA-DB2OLTP for Standalone Db2 Universal Db2 Online Transaction Processing
- DB2U-SA-DB2WH for Standalone Db2 Universal Db2 Warehouse
- This step is required only if the replication configuration already exists from Db2
Warehouse common container to Db2 Warehouse on Red Hat Openshift and Kubernetes or Cloud Pak for
Data and you are configuring a reverse replication from Db2 Warehouse on Red Hat Openshift and
Kubernetes or Cloud Pak for Data to Db2 Warehouse common container: Ensure that the
<REMOTE_DBALIAS>_DR_ENV_TYPE
environment variable type value is set toDB2U-DB2WH-PVT-CC
in the $BLUDR_SHARED_DIR/settings_backup/server.env on your source site. Run the following command:sed -i 's/^ABCDEFGH_DR_ENV_TYPE=DB2WH/ABCDEFGH_DR_ENV_TYPE=DB2U-DB2WH-PVT-CC/' "$BLUDR_SHARED_DIR/settings_backup/server.env
Important: Run the following script to restart the server on your Db2 Warehouse on Red Hat Openshift and Kubernetes or Cloud Pak for Data source site after updating the contents of the server.env file:$BLUDR_HOME/scripts/bin/bludr-restart.sh
- Create a new empty replication set on your source site. Run the
bludr-perform-replication-set-actions.sh
script and select option 5.Note: To create a new replication set , following information is required:- Target database hostname
- Target external database SSL Port
- Add tables to your replication set:
- Create an input file with table information:
cd $HOME cat > input_schema_table_filename.txt <SCHEMA_NAME1>.<TABLE_NAME1> <SCHEMA_NAME2>.<TABLE_NAME2>
- Run the
bludr-add-tables-to-replset.sh
script and enter the complete file path for the input file. For example:/mnt/qrepdata/home/dsadm/input_schema_table_filename.txt
Note: When running this step, the interactive prompts the following option:Do you want to load all tables added to replication? (y/n)
- Option 'y' indicates that you want Q Replication to perform the initial load of tables from source site to target site.
- Option 'n' indicates that you want to automatically start replication for all the tables.
- Create an input file with table information: