Showing the HADR status for Db2
You can monitor the state of your HADR configuration by running the --manage_hadr command with the -status option in the Db2 engine pod.
For example:
oc exec -it c-db2oltp-1616468282925295-db2u-0 -- manage_hadr -status
The following example shows the output from the primary database with an HADR setup that includes two standbys; note the second status section:
#######################################################################
### Db2 Advanced Edition high availability and ###
### disaster recovery (HADR) management ###
#######################################################################
Running HADR action -status on the database BLUDB ...
################################################################################
### The HADR status summary ###
################################################################################
Database Member 0 -- Database BLUDB -- Active -- Up 0 days 00:00:39 -- Date 2021-05-28-03.47.31.838856
####### Primary - Standby 1 ######
HADR_ROLE = PRIMARY
HADR_SYNCMODE = NEARSYNC
HADR_STATE = PEER
PRIMARY_MEMBER_HOST = c-db2oltp-crd-hadr-primary-db2u-0|172.30.174.210
STANDBY_MEMBER_HOST = 172.30.247.77
HADR_CONNECT_STATUS = CONNECTED
HADR_CONNECT_STATUS_TIME = 05/28/2021 03:46:54.501837 (1622173614)
PRIMARY_LOG_FILE,PAGE,POS = S0000009.LOG, 1, 264947956
STANDBY_LOG_FILE,PAGE,POS = S0000009.LOG, 1, 264947956
STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000009.LOG, 1, 264947956
PEER_WINDOW_END = 05/28/2021 03:49:31.000000 (1622173771)
####### Primary - Standby 2 ######
HADR_ROLE = PRIMARY
HADR_SYNCMODE = SUPERASYNC
HADR_STATE = REMOTE_CATCHUP
PRIMARY_MEMBER_HOST = c-db2oltp-crd-hadr-primary-db2u-0|172.30.174.210
STANDBY_MEMBER_HOST = 172.30.105.147
HADR_CONNECT_STATUS = CONNECTED
HADR_CONNECT_STATUS_TIME = 05/28/2021 03:46:55.280238 (1622173615)
PRIMARY_LOG_FILE,PAGE,POS = S0000009.LOG, 1, 264947956
STANDBY_LOG_FILE,PAGE,POS = S0000009.LOG, 1, 264947956
STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000009.LOG, 1, 264947956
GOVERNOR: RUNNING
The HADR action -status was successful