Esempio: Configurazione di Db2 HADR in più OpenShift cluster
Questo esempio presenta un standby primario e uno secondario nello stesso OpenShift progetto all'interno dello stesso cluster, e uno standby ausiliario in un cluster OpenShift diverso (sito di emergenza).
Utilizzando Determinazione dell' Db2 e NodePorts per una configurazione a cluster multipli, le porte per ciascun database nell'esempio sono:
- Primario: 32457
- In attesa: 31384
- Aux1: 32649
Per configurare HADR per database che si trovano in cluster OpenShift diversi:
- Esegui il seguente comando per richiamare lo
setup_config_hadrscript sul pod del database Db2 primario:oc exec -it c-db2oltp-primary-db2u-0 -- setup_config_hadr --db-role primary --primary-name db2oltp-primary --standby-name db2oltp-standby --primary-port 32457 --standby-port 31384 --aux1-name db2oltp-aux --aux1-port 32649 --etcd-host my-etcd-client.my-etcd --etcd-port 2379 --multiclusterL'output del comando contiene le impostazioni di configurazione HADR:
################################################################################ ### Creating HADR configuration file for HADR setup. ### ################################################################################ Database role -- primary primary database formation_id -- db2oltp-primary HADR_REMOTE_INST db2inst1 HADR_TIMEOUT 120 HADR_SYNCMODE NEARSYNC HADR_PEER_WINDOW 120 LOGINDEXBUILD ON HADR_LOCAL_HOST c-db2oltp-primary-db2u-0|c-db2oltp-standby-hadr-svc-ext HADR_LOCAL_SVC 60006|32457 HADR_REMOTE_HOST c-db2oltp-standby-hadr-svc-ext HADR_REMOTE_SVC 31384 HADR_TARGET_LIST c-db2oltp-standby-hadr-svc-ext:31384|c-db2oltp-aux-hadr-svc-ext:32649 etcd: my-etcd-client.my-etcd:2379Se la configurazione ha esito positivo, al termine dell'output dello script viene visualizzato il seguente messaggio:
################################################################################ ### The HADR setup command completed the primary node setup. ### ################################################################################ - Copiare l'immagine di backup del database e il file keystore nell'area di archiviazione dei backup (/mnt/backup/) dal database primario ai database di standby utilizzando rsync. Qui è necessario un passaggio aggiuntivo per copiare da Cluster1 (dove si trova il database primario) a Cluster2 (dove si trova il database ausiliario di standby).
# Copy from primary database to a directory on the host called /tmp/hadr oc rsync c-db2oltp-primary-db2u-0:/mnt/backup/ /tmp/hadr # Copy from the /tmp/hadr directory on the host to the principal standby database oc rsync /tmp/hadr/ c-db2oltp-standby-db2u-0:/mnt/backup/ # After copying /tmp/hadr/ from Cluster1 to Cluster2 oc rsync /tmp/hadr/ c-db2oltp-aux-db2u-0:/mnt/backup/ - Eseguire il seguente comando per richiamare lo
setup_config_hadrscript sul pod del Db2 database secondario principale:oc exec -it c-db2oltp-standby-db2u-0 -- setup_config_hadr --db-role standby --primary-name db2oltp-primary --standby-name db2oltp-standby --primary-port 32457 --standby-port 31384 --aux1-name db2oltp-aux --aux1-port 32649 --etcd-host my-etcd-client.my-etcd --etcd-port 2379 --multiclusterIl risultato del comando:
################################################################################ ### Creating HADR configuration file for HADR setup. ### ################################################################################ Database role -- standby primary database formation_id -- db2oltp-standby HADR_REMOTE_INST db2inst1 HADR_TIMEOUT 120 HADR_SYNCMODE NEARSYNC HADR_PEER_WINDOW 120 LOGINDEXBUILD ON HADR_LOCAL_HOST c-db2oltp-standby-db2u-0|c-db2oltp-primary-hadr-svc-ext HADR_LOCAL_SVC 60007|31384 HADR_REMOTE_HOST c-db2oltp-primary-hadr-svc-ext HADR_REMOTE_SVC 32457 HADR_TARGET_LIST c-db2oltp-primary -hadr-svc-ext:32457|c-db2oltp-aux-hadr-svc-ext:32649 etcd: my-etcd-client.my-etcd:2379 - Esegui il seguente comando per richiamare lo
setup_config_hadrscript sul pod del database Db2 ausiliario di standby :oc exec -it c-db2oltp-aux-db2u-0 -- setup_config_hadr --db-role aux1 --primary-name db2oltp-primary --standby-name db2oltp-standby --primary-port 32457 --standby-port 31384 --aux1-name db2oltp-aux --aux1-port 32649 --etcd-host my-etcd-client.my-etcd --etcd-port 2379 --multiclusterIl risultato del comando:
################################################################################ ### Creating HADR configuration file for HADR setup. ### ################################################################################ Database role -- aux1 primary database formation_id -- db2oltp-aux HADR_REMOTE_INST db2inst1 HADR_TIMEOUT 120 HADR_SYNCMODE NEARSYNC HADR_PEER_WINDOW 120 LOGINDEXBUILD ON HADR_LOCAL_HOST c-db2oltp-aux-db2u-0|c-db2oltp-aux-hadr-svc-ext HADR_LOCAL_SVC 60008|32649 HADR_REMOTE_HOST c-db2oltp-primary-hadr-svc-ext HADR_REMOTE_SVC 32457 HADR_TARGET_LIST c-db2oltp-standby-hadr-svc-ext:31384|c-db2oltp-primary-hadr-svc-ext:32457 etcd: my-etcd-client.my-etcd:2379