Enabling HADR Automatic Client Reroute on Db2

You can enable the Db2 HADR Automatic Client Reroute (ACR) feature by running the manage_hadr command with the -enable_acr option.

You must run this command on both the primary and standby deployments. If all client connections are coming from within the same OpenShift cluster, use the engn-svc service name and port of the other deployment. If client connections are external, use the host name or IP address of the Cloud Pak for Data instance, and the NodePort of the engn-svc service of the other deployment. For example:

Internal clients

On clients within your OpenShift cluster, run the following command to enable HADR automatic client reroute:

oc exec -it primary-db2-svc-id-db2u-0 -- manage_hadr -enable_acr standby-db2-svc-id-db2u-engn-svc:port
oc exec -it standby-db2-svc-id-db2u-0 -- manage_hadr -enable_acr primary-db2-svc-id-db2u-engn-svc:port

where db2oltp-svc-id is the Db2 service identifier on Cloud Pak for Data that is associated with the primary and standby deployments. Use the oc get service command to find the exact values.

For example, if your primary deployment is db2oltp-1616468282925295 and your standby deployment is db2oltp-1616469166354348, the commands would look like this:

oc exec -it c-db2oltp-1616468282925295-db2u-0 -- manage_hadr -enable_acr c-db2oltp-1616469166354348-db2u-engn-svc:50000
oc exec -it c-db2oltp-1616469166354348-db2u-0 -- manage_hadr -enable_acr c-db2oltp-1616468282925295-db2u-engn-svc:50000

External clients

On external clients, run the following command to enable HADR automatic client reroute:

oc exec -it primary-db2oltp-svc-id-db2u-0 -- manage_hadr -enable_acr host_name_or_IP_address:NodePort
oc exec -it standby-db2oltp-svc-id-db2u-0 -- manage_hadr -enable_acr host_name_or_IP_address:NodePort

Where host_name_or_IP_address is the IP address or host name of the Cloud Pak for Data instance. Use the oc get service command to find the NodePort value for the service.

For example, if your primary deployment is db2oltp-1616468282925295 and your standby deployment is db2oltp-1616469166354348, the commands would look like this:

oc exec -it c-db2oltp-1616468282925295-db2u-0 -- manage_hadr -enable_acr 9.121.221.159:31900
oc exec -it c-db2oltp-1616469166354348-db2u-0 -- manage_hadr -enable_acr 9.121.221.159:31806

When ACR is enabled, follow the instructions at Connecting clients to the HADR configuration.

For more information, see Db2 automatic client reroute with HADR.