Updating Db2 Warehouse replication external ports after redeployment
When you disable and then re-enable replication, or after a backup and restore operation that uses OpenShift® APIs for Data Protection (OADP), you need to update 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, IBM® MQ for the capture process, and MQ for the apply process.
If you do not use haproxy as your load balancer, then you must manually forward the following ports with the logic of the load balancer you are using. Refer to Kubernetes documentation for NodePorts and LoadBalancers. Refer to RedHat OpenShift documentation for route, nodeport services and port-forwarding. If you re-deploy the source or target replication pod, the following services will change:(1) c-{db2u_cluster_instance_id}-db2u-engn-svc
(2) c-{db2u_cluster_instance_id}-qrep-rest-svc
(3) c-{db2u_cluster_instance_id}-qrep-mq-svc
You must follow the steps to run
bludr-change-ports.sh to sync up the ports. For example, if you re-deploy the
target replication pod, run bludr-change-ports.sh against the target
replication pod to sync up the changes from the source.Procedure
- After re-enabling replication at the source
- In the Cloud Pak for Data web client, get the deployment
identifier for the source database:
- From the home page of the web client, click .
- Open the actions menu for the database and click Details.
- Under About this database, look for Deployment ID.
In the following examples, the deployment ID is db2wh-1639791500542252 for the source pod and db2wh-1640057971423353 for the target pod.
- On the haproxy server of the cluster, run the
qrep-expose-nodeports.sh script to update the
/etc/haproxy/haproxy.cfg configuration file. The script is packaged inside the
qrep container at /opt/ibm/bludr/scripts/bin/. You run the script outside of
the qrep container. The following commands copy the file from the qrep container to the haproxy
server current location and run the
script:
oc get pod|grep db2wh-1639791500542252 c-db2wh-1639791500542252-qrep-77b6bc4889-xkqjb 1/1 Running 0 4h20m oc cp c-db2wh-1639791500542252-qrep-77b6bc4889-xkqjb:opt/ibm/bludr/scripts/bin/qrep-expose-nodeports.sh qrep-expose-nodeports.sh ./qrep-expose-nodeports.sh db2wh-1639791500542252 ./qrep-expose-nodeports.sh db2wh-1640057971423353
- Find the external port numbers for the source replication
pod:
oc get svc | grep v-1639791500542252-qrep c-db2wh-1639791500542252-qrep-mq-svc NodePort 172.30.247.1 <none> 1414:31703/TCP,1415:31953/TCP 4h17m c-db2wh-1639791500542252-qrep-rest-svc NodePort 172.30.235.94 <none> 9444:30939/TCP
In this case, the numbers are 30939 for the REST server port, 31703 for the capture MQ port, and 31953 for the apply MQ port.
- Find the queue manager alias from the source pod by running the MQ display queue manager command. The source alias will be
VGXEQVHX
.dspmq QMNAME(VGXEQVHX_CQM)
- Find the queue manager alias from the target pod. The target alias will be
GWNOCRLE
.dspmq QMNAME(GWNOCRLE_CQM) QMNAME(GWNOCRLE_AQM)
- Fetch the external Db2® SSL port
numbers.
oc get svc | grep engn | grep db2wh-1639791500542252 c-db2wh-1639791500542252-db2u-engn-svc NodePort 172.30.132.82 <none> 50000:31936/TCP,50001:30742/TCP
- Exec into the source replication
pod:
oc get pod|grep db2wh-1639791500542252 c-db2wh-1639791500542252-qrep-77b6bc4889-xkqjb 1/1 Running 0 4h20m oc exec -it c-db2wh-1639791500542252-qrep-77b6bc4889-xkqjb bash
- Update the source database property LOGG_APPL_INFO to
YES:
db2 update db cfg for bludb using LOG_APPL_INFO YES
- On the source pod, run the bludr-change-ports.sh script, using the numbers
from Step 3 for the REST port (
-rp
), capture port (-cp
), apply port (-ap
), and Db2 Warehouse port (-dp
). The script file is inside the qrep container at /opt/ibm/bludr/scripts/bin../bludr-change-ports.sh -rt source -rd source -rp 30939 -cp 31703 -ap 31953 -dp 30742 -sa source-db-alias -ta target-db-alias
- On the target pod, run the bludr-change-ports.sh script, this time
specifying
-rd target
:./bludr-change-ports.sh -rt source -rd target -rp 30939 -cp 31703 -ap 31953 -dp 30742 -sa source-db-alias -ta target-db-alias
- On both the source and target pods, run the bludr-restart.sh script to
restart replication:
/opt/ibm/bludr/scripts/bin/bludr-restart.sh
- In the Cloud Pak for Data web client, get the deployment
identifier for the source database:
- After re-enabling replication at the target
- Find the external port numbers for the target replication
pod:
oc get svc|grep db2wh-1640057971423353-qrep c-db2wh-1640057971423353-qrep-mq-svc NodePort 172.30.4.126 <none> 1414:30415/TCP,1415:32475/TCP 48s c-db2wh-1640057971423353-qrep-rest-svc NodePort 172.30.65.180 <none> 9444:31452/TCP
In this case, the numbers are 31452 for the REST server port, 30415 for the capture MQ port, and 32475 for the apply MQ port.
- Get the external Db2
Warehouse SSL port number for example pod
db2wh-1640057971423353
:oc get svc | grep engn | grep db2wh-1640057971423353 c-db2oltp-1640057971423353-db2u-engn-svc NodePort 172.30.132.82 <none> 50000:32584/TCP,50001:30689/TCP
- Exec into the target replication
pod:
oc get pod|grep db2wh-1640057971423353-qrep c-db2wh-1640057971423353-qrep-7878599d84-bl5qv 1/1 Running 0 72m oc exec -it c-db2wh-1640057971423353-qrep-7878599d84-bl5qv bash
- Run the bludr-change-ports.sh script, using the numbers from Step 2 for the
REST port (
-rp
), capture port (-cp
), apply port (-ap
), and Db2 Warehouse port (-dp). The script file is inside the qrep container at /opt/ibm/bludr/scripts/bin../bludr-change-ports.sh -rt target -rd target -rp 31452 -cp 30415 -ap 32475 -dp 30689 -sa source-db-alias -ta target-db-alias
- On the corresponding source replication pod, run the bludr-change-ports.sh
script, this time specifying
-rd source
:./bludr-change-ports.sh -rt target -rd source -rp 30939 -cp 31703 -ap 31953 -dp 30689 -sa source-db-alias -ta target-db-alias
- On both the source and target pods, run the bludr-restart.sh script to
restart replication:
/opt/ibm/bludr/scripts/bin/bludr-restart.sh
- Find the external port numbers for the target replication
pod: