Updating replication external ports at the Db2 data source

When redeploying or restoring Q Replication on your Db2 cluster, the disabling and re-enabling of the service changes the port numbers used by the Q Replication service. This causes synchronization issues between the Kubernetes services and the services inside the qrep container. You must resynchronize your services by updating the external port numbers in the replication metadata.

About this task

This procedure uses a script to update the port numbers for the external REST server, the IBM® MQ for the capture process, and the IBM® MQ for the apply process. In the following code examples, 1414 is the internal port number for capture and 1415 is the internal port number for apply. The example port number for the REST API server is 9444.

Note: If you are not using an haproxy configuration, you do not need to run the qrep-expose-nodeports.sh script that is described in Step 3 of this procedure. However, you will need to manage your own Db2® and Q Replication services.

Procedure

  1. After re-enabling replication at the source, review a list of your deployed Db2 instances:
    oc get db2ucluster -n <your_namespace>
    Select the cluster for which you want to reveal the Db2 and Q Replication services.
  2. List the pods for the Db2 cluster:
    oc get po -n <your_namespace> | grep <your_db2u_cluster>
    From the results, identify the Db2 cluster pod common prefix.
  3. Copy the qrep-expose-nodeports.sh script from the qrep container to your infra node:
    qrep-expose-nodeports.sh <db2u_cluster_common_pod_prefix>
  4. Collect the external port numbers on the source for the qrep REST, capture MQ, target MQ, and Db2 SSL services:
    oc get svc | grep <db2u cluster>
  5. On the source Db2 container, update the Db2 database configuration file to turn on the application information log record, which is written at the start of each update transaction:
    db2 update db cfg for bludb using LOG_APPL_INFO YES
  6. On the source qrep container, list the source alias name without the _CQM suffix:
    dspmq | grep CQM
  7. On the target qrep container, list the target alias name without the _AQM suffix:
    dspmq | grep AQM
  8. On the source qrep container,go to /opt/ibm/bludr/scripts/bin and locate the bludr-change-ports.sh script. Run the script for the external ports that you collected in step 4, with the following options:
    • The REST port (-rp)
    • The capture port (-cp)
    • The apply port (-ap)
    • The db2 port (-dp)
    ./bludr-change-ports.sh -rt source -rd source -rp <rest-port-on-source> -cp <capture-port-on-source> -ap <apply-port-on-source> -dp <db2-port-on-source> -sa <source-db-alias> -ta <target-db-alias>
  9. On the target qrep container, locate and run the script, this time specifying the running side with the -rd target option:
    ./bludr-change-ports.sh -rt source -rd target -rp <rest-port-on-source> -cp <capture-port-on-source> -ap <apply-port-on-source> -dp <db2-port-on-source> -sa <source-db-alias> -ta <target-db-alias
  10. On both the source and target qrep containers, run the bludr-restart.sh script to restart replication:
    /opt/ibm/bludr/scripts/bin/bludr-restart.sh

Examples

The following example shows the command syntax and output for retrieving the common prefix for the cluster whmpp1. See step 2:
oc get po | grep whmpp1
c-whmpp1-db2u-0                                    1/1     Running     0              43d
c-whmpp1-db2u-1                                    1/1     Running     0              42d
c-whmpp1-etcd-0                                    1/1     Running     0              43d
c-whmpp1-instdb-tc7dd                              0/1     Completed   0              43d
c-whmpp1-ldap-5799978b-wwkpf                       1/1     Running     0              43d
c-whmpp1-qrep-67944f5899-hn5q2                     1/1     Running     0              43d
c-whmpp1-restore-morph-jdd4g                       0/1     Completed   0              43d
The following example shows the command syntax and output for collecting the external port numbers for services on the cluster, whmpp1. See step 4:
oc get svc | grep whmpp1 
NAME                             TYPE        CLUSTER-IP       EXTERNAL-IP     PORT(S)                                          AGE
c-whmpp1-db2u                    ClusterIP   172.30.194.248   <none>          50000/TCP,50001/TCP,25000/TCP,25001/TCP,25002/
                                                                                     TCP,25003/TCP,25004/TCP,25005/TCP         44d

c-whmpp1-db2u-engn-svc           NodePort    172.30.152.30    <none>        50001:31576/TCP,50000:31397/TCP                  44d
c-whmpp1-db2u-head-engn-svc      NodePort    172.30.46.162    <none>        50001:30678/TCP,50000:32065/TCP                  44d
c-whmpp1-db2u-internal           ClusterIP   None             <none>        50000/TCP,9443/TCP,50052/TCP                     44d
c-whmpp1-etcd                    ClusterIP   None             <none>        2379/TCP,2380/TCP                                44d 
c-whmpp1-ldap                    ClusterIP   172.30.89.227    <none>        50389/TCP                                        44d
c-whmpp1-qrep-mq-svc             NodePort    172.30.200.249   <none>        1414:30827/TCP,1415:32409/TCP                    44d
c-whmpp1-qrep-rest-svc           NodePort    172.30.192.96    <none>        9444:31023/TCP                                   44d
c-whmpp1-tools                   ClusterIP   172.30.70.78     <none>        53/TCP,53/UDP                                    44d
c-whmpp2-db2u                    ClusterIP   172.30.38.90     <none>        50000/TCP,50001/TCP,25000/TCP,25001/TCP,25002/
                                                                               TCP,25003/TCP,25004/TCP,25005/TCP             43d
c-whmpp2-db2u-engn-svc           NodePort    172.30.181.123   <none>        50001:30138/TCP,50000:30526/TCP                  43d
c-whmpp2-db2u-head-engn-svc      NodePort    172.30.203.11    <none>        50001:30831/TCP,50000:31430/TCP                  43d
c-whmpp2-db2u-internal           ClusterIP   None             <none>        50000/TCP,9443/TCP,50052/TCP                     43d
c-whmpp2-etcd                    ClusterIP   None             <none>        2379/TCP,2380/TCP                                43d
c-whmpp2-ldap                    ClusterIP   172.30.185.158   <none>        50389/TCP                                        43d
c-whmpp2-qrep-mq-svc             NodePort    172.30.147.231   <none>        1414:31496/TCP,1415:31139/TCP                    43d
c-whmpp2-qrep-rest-svc           NodePort    172.30.247.204   <none>        9444:32483/TCP                                   43d
c-whmpp2-tools                   ClusterIP   172.30.168.83    <none>        53/TCP,53/UDP                                    43d
db2u-day2-ops-controller-
manager-metrics-service          ClusterIP   172.30.106.68    <none>        8443/TCP                                         44d
The following example shows the command syntax for retrieving the port number for the Db2 SSL service on the cluster whmpp1:
oc get svc | grep "whmpp1" | grep "db2u-eng-svc"
NAME                          TYPE        CLUSTER-IP       EXTERNAL-IP      PORT(S)                              AGE
c-whmpp1-db2u-engn-svc        NodePort    172.30.152.30     <none>          50001:31576/TCP,50000:31397/TCP      44d
The following example shows the command syntax for retrieving the port numbers for the Q Replication REST API server, capture MQ service and apply MQ service on the Db2 on cluster, whmpp1.
oc get svc | grep "whmpp1" | grep "qrep"
c-whmpp1-qrep-mq-svc           NodePort    172.30.200.249   <none>        1414:30827/TCP,1415:32409/TCP       q       44d
c-whmpp1-qrep-rest-svc         NodePort    172.30.192.96    <none>        9444:31023/TCP                              44d