DM8配置MPP主備
配置MPP主備
為了提高MPP系統可靠性,克服由於單節點故障導致整個系統不能繼續正常工作,DM在普通的MPP系統基礎上,引入主備守護機制,將MPP節點作為主庫節點,增加備庫作為備份節點,必要時可切換為主庫代替故障節點工作,提高系統的可靠性和可用性。
環境說明
本例配置2個MPP節點數,每個節點作為主庫,與其備庫組成一個守護組,因此需要配置兩個守護組,取名分別為GRP1、GRP2,主庫名為mpp01/mpp02,對應的備庫例項名分別為mpp11/mpp12。
準備5臺機器dm8mppdw1,dm8mppdw2,dm8mppdw3,dm8mppdw4和dm8mppdw5,dm8mppdw1和dm8mppdw2為主庫,dm8mppdw3和dm8mppdw4和備庫,dm8mppdw5部署監視器。
機器事先都安裝了DM,安裝路徑為’/dm8’,執行程式儲存在’/dm8/bin’目錄中,資料存放路徑為’/dm/data/mpp'。
機器名 IP地址 初始狀態 作業系統
dm8mppdw1 10.10.13.217(對外) 主庫 mpp01 redhat 7.8 10.10.13.217(mal對內) dm8mppdw2 10.10.13.218(對外) 10.10.13.218(mal對內) 主庫 mpp02 redhat 7.8 dm8mppdw3 10.10.13.219(對外) 10.10.13.219(mal對內) 備庫 mpp11 redhat 7.8 dm8mppdw4 10.10.13.220(對外) 10.10.13.220(mal對內) 備庫 mpp12 redhat 7.8 dm8mppdw5 10.10.13.221 確認監視器 redhat 7.8
埠規劃—主庫
例項名 port_num mal_inst_dw_port mal_host mal_port mal_dw_port mpp例項序號 mpp01 5236 5237 10.10.13.217 5238 5239 0 mpp02 5236 5237 10.10.13.218 5238 5239 1
埠規劃—備庫
例項名 port_num mal_inst_dw_port mal_host mal_port mal_dw_port 對應主庫 mpp11 5236 5237 10.10.13.219 5238 5239 mpp01 mpp12 5236 5237 10.10.13.220 5238 5239 mpp02
守護程式規劃
組名 例項名 所在機器 grp1 mpp01 10.10.13.217 mpp11 10.10.13.219 grp2 mpp02 10.10.13.218 mpp12 10.10.13.220
安裝DM資料庫軟體
資料準備
在主庫機器上初始化資料庫到目錄/dm8/data:
mpp01:
[dmdba@dm8mppdw1 ~]$ dminit path=/dm8/data db_name=mpp01 instance_name=mpp01 port_num=5236 page_size=16 case_sensitive=1 charset=0 initdb V8 db version: 0x7000c file dm.key not found, use default license! License will expire on 2022-10-21 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL log file path: /dm8/data/mpp01/mpp0101.log log file path: /dm8/data/mpp01/mpp0102.log write to dir [/dm8/data/mpp01]. create dm database success. 2022-01-20 16:50:09
mpp02:
[dmdba@dm8mppdw2 ~]$ dminit path=/dm8/data db_name=mpp02 instance_name=mpp02 port_num=5236 page_size=16 case_sensitive=1 charset=0 initdb V8 db version: 0x7000c file dm.key not found, use default license! License will expire on 2022-10-21 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL log file path: /dm8/data/mpp02/mpp0201.log log file path: /dm8/data/mpp02/mpp0202.log write to dir [/dm8/data/mpp02]. create dm database success. 2022-01-20 16:50:41
建立DmAPService用於dmrman來執行備份
mpp01:
[root@dm8mppdw1 ~]# /dm8/script/root/dm_service_installer.sh -t dmap Created symlink from /etc/systemd/system/multi-user.target.wants/DmAPService.service to /usr/lib/systemd/system/DmAPService.service. Finished to create the service (DmAPService)
mpp02:
[root@dm8mppdw2 ~]# /dm8/script/root/dm_service_installer.sh -t dmap Created symlink from /etc/systemd/system/multi-user.target.wants/DmAPService.service to /usr/lib/systemd/system/DmAPService.service. Finished to create the service (DmAPService)
mpp11:
[root@dm8mppdw3 ~]# /dm8/script/root/dm_service_installer.sh -t dmap Created symlink from /etc/systemd/system/multi-user.target.wants/DmAPService.service to /usr/lib/systemd/system/DmAPService.service. Finished to create the service (DmAPService)
mpp12:
[root@dm8mppdw4 ~]# /dm8/script/root/dm_service_installer.sh -t dmap Created symlink from /etc/systemd/system/multi-user.target.wants/DmAPService.service to /usr/lib/systemd/system/DmAPService.service. Finished to create the service (DmAPService)
主庫中註冊服務用於啟動資料庫
mpp01:
[root@dm8mppdw1 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/mpp01/dm.ini -p mpp01 -t dmserver Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicempp01.service to /usr/lib/systemd/system/DmServicempp01.service. Finished to create the service (DmServicempp01)
mpp02:
[root@dm8mppdw2 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/mpp02/dm.ini -p mpp02 -t dmserver Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicempp02.service to /usr/lib/systemd/system/DmServicempp02.service. Finished to create the service (DmServicempp02)
正常啟動主資料庫並正常關閉
mpp01:
[root@dm8mppdw1 ~]# service DmServicempp01 start Redirecting to /bin/systemctl start DmServicempp01.service [dmdba@dm8mppdw1 ~]$ disql SYSDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is open login used time : 2.484(ms) disql V8 SQL> select instance_name from v$instance; LINEID INSTANCE_NAME ---------- ------------- 1 MPP01 used time: 5.715(ms). Execute id is 53700. [root@dm8mppdw1 ~]# service DmServicempp01 stop Redirecting to /bin/systemctl stop DmServicempp01.service
mpp02:
[root@dm8mppdw2 ~]# service DmServicempp02 start Redirecting to /bin/systemctl start DmServicempp02.service [dmdba@dm8mppdw2 ~]$ disql SYSDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is open login used time : 2.821(ms) disql V8 SQL> select instance_name from v$instance; LINEID INSTANCE_NAME ---------- ------------- 1 MPP02 used time: 6.061(ms). Execute id is 53700. SQL> [root@dm8mppdw2 ~]# service DmServicempp02 stop Redirecting to /bin/systemctl stop DmServicempp02.service
備份主庫
1. 正常關閉資料庫
mpp01:
[root@dm8mppdw1 ~]# service DmServicempp01 stop Redirecting to /bin/systemctl stop DmServicempp01.service
mpp02:
[root@dm8mppdw2 ~]# service DmServicempp02 stop Redirecting to /bin/systemctl stop DmServicempp02.service
2.使用dmrman來進行冷備份
mpp01:
[dmdba@dm8mppdw1 ~]$ dmrman CTLSTMT="backup database '/dm8/data/mpp01/dm.ini' full backupset '/dm8/mpp01_full_bak_1'" dmrman V8 backup database '/dm8/data/mpp01/dm.ini' full backupset '/dm8/mpp01_full_bak_1' file dm.key not found, use default license! Database mode = 0, oguid = 0 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL EP[0]'s cur_lsn[24618], file_lsn[24618] Processing backupset /dm8/mpp01_full_bak_1 [Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00] backup successfully! time used: 00:00:01.913
mpp02:
[dmdba@dm8mppdw2 ~]$ dmrman CTLSTMT="backup database '/dm8/data/mpp02/dm.ini' full backupset '/dm8/mpp02_full_bak_1'" dmrman V8 backup database '/dm8/data/mpp02/dm.ini' full backupset '/dm8/mpp02_full_bak_1' file dm.key not found, use default license! Database mode = 0, oguid = 0 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL EP[0]'s cur_lsn[24618], file_lsn[24618] Processing backupset /dm8/mpp02_full_bak_1 [Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00] backup successfully! time used: 00:00:01.750
將主庫的備份複製備庫:
將mpp01的備份複製到mpp11所在主機上:
[dmdba@dm8mppdw1 dm8]$ scp -r mpp01_full_bak_1 10.10.13.219:/dm8 The authenticity of host '10.10.13.219 (10.10.13.219)' can't be established. ECDSA key fingerprint is SHA256:6O8c9WEeEYPbL4ncdRR1RsrjxxmfzPq9Tkq4/6uLSP4. ECDSA key fingerprint is MD5:e1:73:3e:8d:79:be:5c:82:0f:c7:58:79:45:ad:df:86. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.10.13.219' (ECDSA) to the list of known hosts. dmdba@10.10.13.219's password: mpp01_full_bak_1.bak 100% 9942KB 13.1MB/s 00:00 mpp01_full_bak_1.meta 100% 77KB 3.4MB/s 00:00 [dmdba@dm8mppdw1 dm8]$
將mpp02的備份複製到mpp12所在主機上:
[dmdba@dm8mppdw2 dm8]$ scp -r mpp02_full_bak_1 10.10.13.220:/dm8 The authenticity of host '10.10.13.220 (10.10.13.220)' can't be established. ECDSA key fingerprint is SHA256:6O8c9WEeEYPbL4ncdRR1RsrjxxmfzPq9Tkq4/6uLSP4. ECDSA key fingerprint is MD5:e1:73:3e:8d:79:be:5c:82:0f:c7:58:79:45:ad:df:86. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.10.13.220' (ECDSA) to the list of known hosts. dmdba@10.10.13.220's password: mpp02_full_bak_1.bak 100% 9942KB 16.7MB/s 00:00 mpp02_full_bak_1.meta 100% 77KB 2.5MB/s 00:00 [dmdba@dm8mppdw2 dm8]$
建立備庫備庫並恢復
備庫mpp11:
[dmdba@dm8mppdw3 dm8]$ dminit path=/dm8/data db_name=mpp01 instance_name=mpp11 port_num=5236 page_size=16 case_sensitive=1 charset=0 initdb V8 db version: 0x7000c file dm.key not found, use default license! License will expire on 2022-10-21 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL log file path: /dm8/data/mpp01/mpp0101.log log file path: /dm8/data/mpp01/mpp0102.log write to dir [/dm8/data/mpp01]. create dm database success. 2022-01-24 15:04:44
備庫mpp12:
[dmdba@dm8mppdw4 dm8]$ dminit path=/dm8/data db_name=mpp02 instance_name=mpp12 port_num=5236 page_size=16 case_sensitive=1 charset=0 initdb V8 db version: 0x7000c file dm.key not found, use default license! License will expire on 2022-10-21 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL log file path: /dm8/data/mpp02/mpp0201.log log file path: /dm8/data/mpp02/mpp0202.log write to dir [/dm8/data/mpp02]. create dm database success. 2022-01-24 15:38:12
恢復備庫
備庫mpp11:
[dmdba@dm8mppdw3 dm8]$ dmrman CTLSTMT="restore database '/dm8/data/mpp01/dm.ini' from backupset '/dm8/mpp01_full_bak_1'" dmrman V8 restore database '/dm8/data/mpp01/dm.ini' from backupset '/dm8/mpp01_full_bak_1' file dm.key not found, use default license! Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL [Percent:100.00%][Speed:0.00M/s][Cost:00:00:07][Remaining:00:00:00] restore successfully. time used: 00:00:07.659 [dmdba@dm8mppdw3 dm8]$ [dmdba@dm8mppdw3 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/mpp01/dm.ini' from backupset '/dm8/mpp01_full_bak_1'" dmrman V8 recover database '/dm8/data/mpp01/dm.ini' from backupset '/dm8/mpp01_full_bak_1' file dm.key not found, use default license! Database mode = 0, oguid = 0 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL EP[0]'s cur_lsn[24618], file_lsn[24618] no log generates while the backupset [/dm8/mpp01_full_bak_1] created recover successfully! time used: 317.800(ms) [dmdba@dm8mppdw3 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/mpp01/dm.ini' UPDATE DB_MAGIC" dmrman V8 recover database '/dm8/data/mpp01/dm.ini' UPDATE DB_MAGIC file dm.key not found, use default license! Database mode = 0, oguid = 0 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL EP[0]'s cur_lsn[24618], file_lsn[24618] recover successfully! time used: 00:00:01.080
備庫mpp12:
[dmdba@dm8mppdw4 dm8]$ dmrman CTLSTMT="restore database '/dm8/data/mpp02/dm.ini' from backupset '/dm8/mpp02_full_bak_1'" dmrman V8 restore database '/dm8/data/mpp02/dm.ini' from backupset '/dm8/mpp02_full_bak_1' file dm.key not found, use default license! Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL [Percent:100.00%][Speed:0.00M/s][Cost:00:00:07][Remaining:00:00:00] restore successfully. time used: 00:00:07.202 [dmdba@dm8mppdw4 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/mpp02/dm.ini' from backupset '/dm8/mpp02_full_bak_1'" dmrman V8 recover database '/dm8/data/mpp02/dm.ini' from backupset '/dm8/mpp02_full_bak_1' file dm.key not found, use default license! Database mode = 0, oguid = 0 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL EP[0]'s cur_lsn[24618], file_lsn[24618] no log generates while the backupset [/dm8/mpp02_full_bak_1] created recover successfully! time used: 341.601(ms) [dmdba@dm8mppdw4 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/mpp02/dm.ini' UPDATE DB_MAGIC" dmrman V8 recover database '/dm8/data/mpp02/dm.ini' UPDATE DB_MAGIC file dm.key not found, use default license! Database mode = 0, oguid = 0 Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL EP[0]'s cur_lsn[24618], file_lsn[24618] recover successfully! time used: 00:00:01.058
配置操作
主庫mpp01
配置dm.ini
配置dm.ini檔案,配置以下引數:
INSTANCE_NAME = MPP01 PORT_NUM = 5236 #資料庫例項監聽埠 DW_INACTIVE_INTERVAL = 60 #接收守護程式訊息超時時間 ALTER_MODE_STATUS = 0 #不允許手工方式修改例項模式/狀態 ENABLE_OFFLINE_TS = 2 #不允許備庫OFFLINE表空間 MAL_INI = 1 #開啟MAL系統 ARCH_INI = 1 #開啟歸檔配置 MPP_INI = :1 #啟用MPP配置 RLOG_SEND_APPLY_MON = 64 #統計最近64次的日誌傳送資訊
配置dmmal.ini
配置MAL系統,各主備庫的dmmal.ini配置必須完全一致,MAL_HOST使用內部網路IP,MAL_PORT與dm.ini中PORT_NUM使用不同的埠值,MAL_DW_PORT是各例項對應的守護程式之間,以及守護程式和監視器之間的通訊埠,配置如下:
MAL_CHECK_INTERVAL = 5 #MAL鏈路檢測時間間隔 MAL_CONN_FAIL_INTERVAL = 5 #判定MAL鏈路斷開的時間 [MAL_INST1] MAL_INST_NAME = MPP01 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.217 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.217 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST2] MAL_INST_NAME = MPP02 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.218 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.218 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST3] MAL_INST_NAME = MPP11 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.219 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.219 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST4] MAL_INST_NAME = MPP12 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.220 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.220 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [dmdba@dm8mppdw1 mpp01]$ vi dmmal.ini MAL_CHECK_INTERVAL = 5 MAL_CONN_FAIL_INTERVAL = 5 [MAL_INST1] MAL_INST_NAME = MPP01 MAL_HOST = 10.10.13.217 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.217 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST2] MAL_INST_NAME = MPP02 MAL_HOST = 10.10.13.218 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.218 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST3] MAL_INST_NAME = MPP11 MAL_HOST = 10.10.13.219 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.219 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST4] MAL_INST_NAME = MPP12 MAL_HOST = 10.10.13.220 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.220 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237
配置dmarch.ini
修改dmarch.ini,配置本地歸檔和即時歸檔。
除了本地歸檔外,其他歸檔配置項中的ARCH_DEST表示例項是Primary模式時,需要同步歸檔資料的目標例項名。當前例項mpp01是主庫,需要向即時備庫mpp11同步資料,因此即時歸檔的ARCH_DEST配置為mpp11。
[ARCHIVE_REALTIME1] ARCH_TYPE = REALTIME #即時歸檔型別 ARCH_DEST = MPP11 #即時歸檔目標例項名 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL #本地歸檔型別 ARCH_DEST = /dm8/arch #本地歸檔檔案存放路徑 ARCH_FILE_SIZE = 128 #單位Mb,本地單個歸檔檔案最大值 ARCH_SPACE_LIMIT = 0 #單位Mb,0表示無限制,範圍1024~4294967294M [dmdba@dm8mppdw1 mpp01]$ vi dmarch.ini [ARCHIVE_REALTIME1] ARCH_TYPE = REALTIME ARCH_DEST = MPP11 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm8/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0
配置dmmpp.ctl
mmpp.ctl是二進位制檔案,由dmmpp.ini文字透過dmctlcvt工具轉換而來,dmmpp.ini配置項如下表:
[SERVICE_NAME1] MPP_SEQ_NO = 0 MPP_INST_NAME = MPP01 [SERVICE_NAME2] MPP_SEQ_NO = 1 MPP_INST_NAME = MPP02 [dmdba@dm8mppdw1 mpp01]$ vi dmmpp.ini [SERVICE_NAME1] MPP_SEQ_NO = 0 MPP_INST_NAME = MPP01 [SERVICE_NAME2] MPP_SEQ_NO = 1 MPP_INST_NAME = MPP02
使用DM提供的工具dmctlcvt將dmmpp.ini轉換成dmmpp.ctl,dmctlcvt工具在DM安裝目錄的“bin”子目錄中。轉換生成的dmmpp.ctl需要放在與dm.ini同一個目錄。假設DM的安裝路徑為c盤根目錄,下面的命令將dmmpp.ini轉換為dmmpp.ctl,命令中的
“TYPE=2”參數列示將文字檔案轉換成控制檔案,也可以使用“TYPE=1”引數進行逆向轉換。
[dmdba@dm8mppdw1 mpp01]$ dmctlcvt type=2 src=/dm8/data/mpp01/dmmpp.ini dest=/dm8/data/mpp01/dmmpp.ctl DMCTLCVT V8 convert txt to ctl success!
配置dmwatcher.ini
修改dmwatcher.ini配置守護程式,配置為全域性守護型別,使用自動切換模式。
[GRP1] DW_TYPE = GLOBAL #全域性守護型別 DW_MODE = AUTO #自動切換模式 生產建議設定成手動 DW_ERROR_TIME = 10 #遠端守護程式故障認定時間 INST_RECOVER_TIME = 60 #主庫守護程式啟動恢復的間隔時間 INST_ERROR_TIME = 10 #本地例項故障認定時間 INST_OGUID = 333333 #守護系統唯一OGUID值 INST_INI = /dm8/data/mpp01/dm.ini #dm.ini配置檔案路徑 INST_AUTO_RESTART = 1 #開啟例項的自動啟動功能(建議設定成0) INST_STARTUP_CMD = /dm8/bin/dmserver #命令列方式啟動 RLOG_SEND_THRESHOLD = 0 #指定主庫傳送日誌到備庫的時間閥值,預設關閉 RLOG_APPLY_THRESHOLD = 0 #指定備庫重演日誌的時間閥值,預設關閉 [dmdba@dm8mppdw1 mpp01]$ vi dmwatcher.ini [GRP1] DW_TYPE = GLOBAL DW_MODE = AUTO DW_ERROR_TIME = 10 INST_RECOVER_TIME = 60 INST_ERROR_TIME = 10 INST_OGUID = 333333 INST_INI = /dm8/data/mpp01/dm.ini INST_AUTO_RESTART = 1 INST_STARTUP_CMD = /dm8/bin/dmserver RLOG_SEND_THRESHOLD = 0 RLOG_APPLY_THRESHOLD = 0
主庫mpp02
配置dm.ini
配置dm.ini檔案,配置以下引數:
INSTANCE_NAME = MPP02 PORT_NUM = 5236 #資料庫例項監聽埠 DW_INACTIVE_INTERVAL = 60 #接收守護程式訊息超時時間 ALTER_MODE_STATUS = 0 #不允許手工方式修改例項模式/狀態 ENABLE_OFFLINE_TS = 2 #不允許備庫OFFLINE表空間 MAL_INI = 1 #開啟MAL系統 ARCH_INI = 1 #開啟歸檔配置 MPP_INI = 1 #啟用MPP配置 RLOG_SEND_APPLY_MON = 64 #統計最近64次的日誌傳送資訊
配置dmmal.ini
配置MAL系統,各主備庫的dmmal.ini配置必須完全一致,MAL_HOST使用內部網路IP,MAL_PORT與dm.ini中PORT_NUM使用不同的埠值,MAL_DW_PORT是各例項對應的守護程式之間,以及守護程式和監視器之間的通訊埠,配置如下:
MAL_CHECK_INTERVAL = 5 #MAL鏈路檢測時間間隔 MAL_CONN_FAIL_INTERVAL = 5 #判定MAL鏈路斷開的時間 [MAL_INST1] MAL_INST_NAME = MPP01 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.217 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.217 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST2] MAL_INST_NAME = MPP02 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.218 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.218 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST3] MAL_INST_NAME = MPP11 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.219 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.219 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST4] MAL_INST_NAME = MPP12 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.220 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.220 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [dmdba@dm8mppdw2 mpp02]$ vi dmmal.ini MAL_CHECK_INTERVAL = 5 MAL_CONN_FAIL_INTERVAL = 5 [MAL_INST1] MAL_INST_NAME = MPP01 MAL_HOST = 10.10.13.217 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.217 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST2] MAL_INST_NAME = MPP02 MAL_HOST = 10.10.13.218 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.218 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST3] MAL_INST_NAME = MPP11 MAL_HOST = 10.10.13.219 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.219 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST4] MAL_INST_NAME = MPP12 MAL_HOST = 10.10.13.220 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.220 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237
配置dmarch.ini
修改dmarch.ini,配置本地歸檔和即時歸檔。
除了本地歸檔外,其他歸檔配置項中的ARCH_DEST表示例項是Primary模式時,需要同步歸檔資料的目標例項名。當前例項mpp02是主庫,需要向即時備庫mpp12同步資料,因此即時歸檔的ARCH_DEST配置為mpp12。
[ARCHIVE_REALTIME1] ARCH_TYPE = REALTIME #即時歸檔型別 ARCH_DEST = MPP12 #即時歸檔目標例項名 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL #本地歸檔型別 ARCH_DEST = /dm8/arch #本地歸檔檔案存放路徑 ARCH_FILE_SIZE = 128 #單位Mb,本地單個歸檔檔案最大值 ARCH_SPACE_LIMIT = 0 #單位Mb,0表示無限制,範圍1024~4294967294M [dmdba@dm8mppdw2 mpp02]$ vi dmarch.ini [ARCHIVE_REALTIME1] ARCH_TYPE = REALTIME ARCH_DEST = MPP12 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm8/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0
配置dmmpp.ctl
將主庫mpp01上的dmpp.ctl複製過來
[dmdba@dm8mppdw1 mpp01]$ scp dmmpp.ctl 10.10.13.218:/dm8/data/mpp02/ The authenticity of host '10.10.13.218 (10.10.13.218)' can't be established. ECDSA key fingerprint is SHA256:6O8c9WEeEYPbL4ncdRR1RsrjxxmfzPq9Tkq4/6uLSP4. ECDSA key fingerprint is MD5:e1:73:3e:8d:79:be:5c:82:0f:c7:58:79:45:ad:df:86. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.10.13.218' (ECDSA) to the list of known hosts. dmdba@10.10.13.218's password: dmmpp.ctl 100% 41KB 1.3MB/s 00:00 [dmdba@dm8mppdw1 mpp01]$
配置dmwatcher.ini
修改dmwatcher.ini配置守護程式,配置為全域性守護型別,使用自動切換模式。
[GRP2] DW_TYPE = GLOBAL #全域性守護型別 DW_MODE = AUTO #自動切換模式 生產建議設定成手動 DW_ERROR_TIME = 10 #遠端守護程式故障認定時間 INST_RECOVER_TIME = 60 #主庫守護程式啟動恢復的間隔時間 INST_ERROR_TIME = 10 #本地例項故障認定時間 INST_OGUID = 444444 #守護系統唯一OGUID值 INST_INI = /dm8/data/mpp02/dm.ini #dm.ini配置檔案路徑 INST_AUTO_RESTART = 1 #開啟例項的自動啟動功能(建議設定成0) INST_STARTUP_CMD = /dm8/bin/dmserver #命令列方式啟動 RLOG_SEND_THRESHOLD = 0 #指定主庫傳送日誌到備庫的時間閥值,預設關閉 RLOG_APPLY_THRESHOLD = 0 #指定備庫重演日誌的時間閥值,預設關閉 [dmdba@dm8mppdw2 mpp02]$ vi dmwatcher.ini [GRP2] DW_TYPE = GLOBAL DW_MODE = AUTO DW_ERROR_TIME = 10 INST_RECOVER_TIME = 60 INST_ERROR_TIME = 10 INST_OGUID = 444444 INST_INI = /dm8/data/mpp02/dm.ini INST_AUTO_RESTART = 1 INST_STARTUP_CMD = /dm8/bin/dmserver RLOG_SEND_THRESHOLD = 0 RLOG_APPLY_THRESHOLD = 0
配置備庫
mpp11
配置dm.ini
配置dm.ini檔案,配置以下引數:
INSTANCE_NAME = MPP11 PORT_NUM = 5236 #資料庫例項監聽埠 DW_INACTIVE_INTERVAL = 60 #接收守護程式訊息超時時間 ALTER_MODE_STATUS = 0 #不允許手工方式修改例項模式/狀態 ENABLE_OFFLINE_TS = 2 #不允許備庫OFFLINE表空間 MAL_INI = 1 #開啟MAL系統 ARCH_INI = 1 #開啟歸檔配置 MPP_INI = 1 #啟用MPP配置 RLOG_SEND_APPLY_MON = 64 #統計最近64次的日誌傳送資訊
配置dmmal.ini
配置MAL系統,各主備庫的dmmal.ini配置必須完全一致,MAL_HOST使用內部網路IP,MAL_PORT與dm.ini中PORT_NUM使用不同的埠值,MAL_DW_PORT是各例項對應的守護程式之間,以及守護程式和監視器之間的通訊埠,配置如下:
MAL_CHECK_INTERVAL = 5 #MAL鏈路檢測時間間隔 MAL_CONN_FAIL_INTERVAL = 5 #判定MAL鏈路斷開的時間 [MAL_INST1] MAL_INST_NAME = MPP01 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.217 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.217 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST2] MAL_INST_NAME = MPP02 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.218 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.218 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST3] MAL_INST_NAME = MPP11 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.219 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.219 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST4] MAL_INST_NAME = MPP12 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.220 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.220 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [dmdba@dm8mppdw3 mpp01]$ vi dmmal.ini MAL_CHECK_INTERVAL = 5 MAL_CONN_FAIL_INTERVAL = 5 [MAL_INST1] MAL_INST_NAME = MPP01 MAL_HOST = 10.10.13.217 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.217 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST2] MAL_INST_NAME = MPP02 MAL_HOST = 10.10.13.218 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.218 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST3] MAL_INST_NAME = MPP11 MAL_HOST = 10.10.13.219 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.219 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST4] MAL_INST_NAME = MPP12 MAL_HOST = 10.10.13.220 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.220 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237
配置dmarch.ini
修改dmarch.ini,配置本地歸檔和即時歸檔。
除了本地歸檔外,其他歸檔配置項中的ARCH_DEST表示例項是Primary模式時,需要同步歸檔資料的目標例項名。當前例項mpp11是備庫,守護系統配置完成後,可能在各種故障處理中,mpp11切換為新的主庫,正常情況下,mpp01會切換為新的備庫,需要向
mpp01同步資料,因此即時歸檔的ARCH_DEST配置為mpp01
[ARCHIVE_REALTIME1] ARCH_TYPE = REALTIME #即時歸檔型別 ARCH_DEST = MPP01 #即時歸檔目標例項名 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL #本地歸檔型別 ARCH_DEST = /dm8/arch #本地歸檔檔案存放路徑 ARCH_FILE_SIZE = 128 #單位Mb,本地單個歸檔檔案最大值 ARCH_SPACE_LIMIT = 0 #單位Mb,0表示無限制,範圍1024~4294967294M [dmdba@dm8mppdw3 mpp01]$ vi dmarch.ini [ARCHIVE_REALTIME1] ARCH_TYPE = REALTIME ARCH_DEST = MPP01 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm8/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0
配置dmmpp.ctl
將主庫mpp01上的dmpp.ctl複製過來
[dmdba@dm8mppdw1 mpp01]$ scp dmmpp.ctl 10.10.13.219:/dm8/data/mpp01/ dmdba@10.10.13.219's password: dmmpp.ctl 100% 41KB 1.4MB/s 00:00
配置dmwatcher.ini
修改dmwatcher.ini配置守護程式,配置為全域性守護型別,使用自動切換模式。
[GRP1] DW_TYPE = GLOBAL #全域性守護型別 DW_MODE = AUTO #自動切換模式 生產建議設定成手動 DW_ERROR_TIME = 10 #遠端守護程式故障認定時間 INST_RECOVER_TIME = 60 #主庫守護程式啟動恢復的間隔時間 INST_ERROR_TIME = 10 #本地例項故障認定時間 INST_OGUID = 333333 #守護系統唯一OGUID值 INST_INI = /dm8/data/mpp01/dm.ini #dm.ini配置檔案路徑 INST_AUTO_RESTART = 1 #開啟例項的自動啟動功能(建議設定成0) INST_STARTUP_CMD = /dm8/bin/dmserver #命令列方式啟動 RLOG_SEND_THRESHOLD = 0 #指定主庫傳送日誌到備庫的時間閥值,預設關閉 RLOG_APPLY_THRESHOLD = 0 #指定備庫重演日誌的時間閥值,預設關閉 [dmdba@dm8mppdw3 mpp01]$ vi dmwatcher.ini [GRP1] DW_TYPE = GLOBAL DW_MODE = AUTO DW_ERROR_TIME = 10 INST_RECOVER_TIME = 60 INST_ERROR_TIME = 10 INST_OGUID = 333333 INST_INI = /dm8/data/mpp01/dm.ini INST_AUTO_RESTART = 1 INST_STARTUP_CMD = /dm8/bin/dmserver RLOG_SEND_THRESHOLD = 0 RLOG_APPLY_THRESHOLD = 0
配置備庫
mpp12
配置dm.ini
配置dm.ini檔案,配置以下引數:
INSTANCE_NAME = MPP12 PORT_NUM = 5236 #資料庫例項監聽埠 DW_INACTIVE_INTERVAL = 60 #接收守護程式訊息超時時間 ALTER_MODE_STATUS = 0 #不允許手工方式修改例項模式/狀態 ENABLE_OFFLINE_TS = 2 #不允許備庫OFFLINE表空間 MAL_INI = 1 #開啟MAL系統 ARCH_INI = 1 #開啟歸檔配置 MPP_INI = 1 #啟用MPP配置 RLOG_SEND_APPLY_MON = 64 #統計最近64次的日誌傳送資訊
配置dmmal.ini
配置MAL系統,各主備庫的dmmal.ini配置必須完全一致,MAL_HOST使用內部網路IP,MAL_PORT與dm.ini中PORT_NUM使用不同的埠值,MAL_DW_PORT是各例項對應的守護程式之間,以及守護程式和監視器之間的通訊埠,配置如下:
MAL_CHECK_INTERVAL = 5 #MAL鏈路檢測時間間隔 MAL_CONN_FAIL_INTERVAL = 5 #判定MAL鏈路斷開的時間 [MAL_INST1] MAL_INST_NAME = MPP01 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.217 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.217 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST2] MAL_INST_NAME = MPP02 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.218 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.218 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST3] MAL_INST_NAME = MPP11 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.219 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.219 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [MAL_INST4] MAL_INST_NAME = MPP12 #例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 10.10.13.220 #MAL系統監聽TCP連線的IP地址 MAL_PORT = 5238 #MAL系統監聽TCP連線的埠 MAL_INST_HOST = 10.10.13.220 #例項的對外服務IP地址 MAL_INST_PORT = 5236 #例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 5239 #例項對應的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 5237 #例項監聽守護程式TCP連線的埠 [dmdba@dm8mppdw4 mpp02]$ vi dmmal.ini MAL_CHECK_INTERVAL = 5 MAL_CONN_FAIL_INTERVAL = 5 [MAL_INST1] MAL_INST_NAME = MPP01 MAL_HOST = 10.10.13.217 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.217 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST2] MAL_INST_NAME = MPP02 MAL_HOST = 10.10.13.218 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.218 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST3] MAL_INST_NAME = MPP11 MAL_HOST = 10.10.13.219 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.219 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237 [MAL_INST4] MAL_INST_NAME = MPP12 MAL_HOST = 10.10.13.220 MAL_PORT = 5238 MAL_INST_HOST = 10.10.13.220 MAL_INST_PORT = 5236 MAL_DW_PORT = 5239 MAL_INST_DW_PORT = 5237
配置dmarch.ini
修改dmarch.ini,配置本地歸檔和即時歸檔。
除了本地歸檔外,其他歸檔配置項中的ARCH_DEST表示例項是Primary模式時,需要同步歸檔資料的目標例項名。當前例項mpp12是備庫,守護系統配置完成後,可能在各種故障處理中,mpp12切換為新的主庫,正常情況下,mpp02會切換為新的備庫,需要向
mpp02同步資料,因此即時歸檔的ARCH_DEST配置為mpp02
[ARCHIVE_REALTIME1] ARCH_TYPE = REALTIME #即時歸檔型別 ARCH_DEST = MPP02 #即時歸檔目標例項名 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL #本地歸檔型別 ARCH_DEST = /dm8/arch #本地歸檔檔案存放路徑 ARCH_FILE_SIZE = 128 #單位Mb,本地單個歸檔檔案最大值 ARCH_SPACE_LIMIT = 0 #單位Mb,0表示無限制,範圍1024~4294967294M [dmdba@dm8mppdw4 mpp02]$ vi dmarch.ini [ARCHIVE_REALTIME1] ARCH_TYPE = REALTIME ARCH_DEST = MPP02 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm8/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0
配置dmmpp.ctl
將主庫mpp01上的dmpp.ctl複製過來
[dmdba@dm8mppdw1 mpp01]$ scp dmmpp.ctl 10.10.13.220:/dm8/data/mpp02 The authenticity of host '10.10.13.220 (10.10.13.220)' can't be established. ECDSA key fingerprint is SHA256:6O8c9WEeEYPbL4ncdRR1RsrjxxmfzPq9Tkq4/6uLSP4. ECDSA key fingerprint is MD5:e1:73:3e:8d:79:be:5c:82:0f:c7:58:79:45:ad:df:86. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.10.13.220' (ECDSA) to the list of known hosts. dmdba@10.10.13.220's password: dmmpp.ctl 100% 41KB 2.1MB/s 00:00
配置dmwatcher.ini
修改dmwatcher.ini配置守護程式,配置為全域性守護型別,使用自動切換模式。
[GRP2] DW_TYPE = GLOBAL #全域性守護型別 DW_MODE = AUTO #自動切換模式 生產建議設定成手動 DW_ERROR_TIME = 10 #遠端守護程式故障認定時間 INST_RECOVER_TIME = 60 #主庫守護程式啟動恢復的間隔時間 INST_ERROR_TIME = 10 #本地例項故障認定時間 INST_OGUID = 444444 #守護系統唯一OGUID值 INST_INI = /dm8/data/mpp02/dm.ini #dm.ini配置檔案路徑 INST_AUTO_RESTART = 1 #開啟例項的自動啟動功能(建議設定成0) INST_STARTUP_CMD = /dm8/bin/dmserver #命令列方式啟動 RLOG_SEND_THRESHOLD = 0 #指定主庫傳送日誌到備庫的時間閥值,預設關閉 RLOG_APPLY_THRESHOLD = 0 #指定備庫重演日誌的時間閥值,預設關閉 [dmdba@dm8mppdw2 mpp02]$ vi dmwatcher.ini [GRP2] DW_TYPE = GLOBAL DW_MODE = AUTO DW_ERROR_TIME = 10 INST_RECOVER_TIME = 60 INST_ERROR_TIME = 10 INST_OGUID = 444444 INST_INI = /dm8/data/mpp02/dm.ini INST_AUTO_RESTART = 1 INST_STARTUP_CMD = /dm8/bin/dmserver RLOG_SEND_THRESHOLD = 0 RLOG_APPLY_THRESHOLD = 0
主庫啟動到mount狀態設定oguid
主庫mpp01:
[dmdba@dm8mppdw1 ~]$ dmserver /dm8/data/mpp01/dm.ini mount file dm.key not found, use default license! version info: develop DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT startup... Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL Database mode = 0, oguid = 0 License will expire on 2022-10-21 file lsn: 24618 ndct db load finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct fill fast pool finished nsvr_startup end. aud sys init success. aud rt sys init success. systables desc init success. ndct_db_load_info success. SYSTEM IS READY.
啟動命令列工具 DIsql,使用 MPP 型別為 LOCAL 方式,登入主庫修改資料庫為Primary 模式。)
[dmdba@dm8mppdw1 ~]$ disql SYSDBA/SYSDBA@localhost:5236#"{mpp_type=local}" Server[localhost:5236]:mode is normal, state is mount login used time : 2.701(ms) disql V8 SQL> SQL> sp_set_oguid(333333); DMSQL executed successfully used time: 77.628(ms). Execute id is 0.
修改資料庫模式
SQL> alter database primary; executed successfully used time: 91.249(ms). Execute id is 0.
主庫mpp02:
[dmdba@dm8mppdw2 mpp02]$ dmserver /dm8/data/mpp02/dm.ini mount file dm.key not found, use default license! version info: develop DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT startup... Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL Database mode = 0, oguid = 0 License will expire on 2022-10-21 begin redo pwr log collect, last ckpt lsn: 24618 ... redo pwr log collect finished main rfil[/dm8/data/mpp02/mpp0201.log]'s grp collect 0 valid pwr record, discard 0 invalid pwr record EP[0]'s cur_lsn[24618], file_lsn[24618] begin redo log recover, last ckpt lsn: 24618 ... redo log recover finished ndct db load finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct fill fast pool finished nsvr_startup end. aud sys init success. aud rt sys init success. systables desc init success. ndct_db_load_info success. SYSTEM IS READY. [dmdba@dm8mppdw2 mpp02]$ disql SYSDBA/SYSDBA@localhost:5236#"{mpp_type=local}" Server[localhost:5236]:mode is normal, state is mount login used time : 2.835(ms) disql V8 SQL> sp_set_oguid(444444); DMSQL executed successfully used time: 150.390(ms). Execute id is 0. SQL>
修改資料庫模式
SQL> alter database primary; executed successfully used time: 98.390(ms). Execute id is 0.
備庫啟動到mount狀態設定oguid
備庫mpp11:
[dmdba@dm8mppdw3 ~]$ dmserver /dm8/data/mpp01/dm.ini mount file dm.key not found, use default license! version info: develop DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT startup... Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL Database mode = 0, oguid = 0 License will expire on 2022-10-21 file lsn: 24618 ndct db load finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct fill fast pool finished nsvr_startup end. aud sys init success. aud rt sys init success. systables desc init success. ndct_db_load_info success. SYSTEM IS READY. [dmdba@dm8mppdw3 mpp01]$ disql SYSDBA/SYSDBA@localhost:5236 Server[localhost:5236]:mode is normal, state is mount login used time : 4.452(ms) disql V8 SQL> sp_set_oguid(333333); DMSQL executed successfully used time: 148.410(ms). Execute id is 0. SQL>
修改資料庫模式
SQL> alter database standby; executed successfully used time: 114.912(ms). Execute id is 0.
備庫mpp12:
[dmdba@dm8mppdw4 ~]$ dmserver /dm8/data/mpp02/dm.ini mount file dm.key not found, use default license! version info: develop DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT startup... Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL Database mode = 0, oguid = 0 License will expire on 2022-10-21 file lsn: 24618 ndct db load finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct fill fast pool finished nsvr_startup end. aud sys init success. aud rt sys init success. systables desc init success. ndct_db_load_info success. SYSTEM IS READY. [dmdba@dm8mppdw4 mpp02]$ disql SYSDBA/SYSDBA@localhost:5236#"{mpp_type=local}" Server[localhost:5236]:mode is normal, state is mount login used time : 2.872(ms) disql V8 SQL> sp_set_oguid(444444); DMSQL executed successfully used time: 55.134(ms). Execute id is 0.
修改資料庫模式
SQL> alter database standby; executed successfully used time: 53.966(ms). Execute id is 0.
註冊並啟動守護程式
主庫mpp01:
[root@dm8mppdw1 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/mpp01/dmwatcher.ini -p mpp01 -t dmwatcher Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicempp01.service to /usr/lib/systemd/system/DmWatcherServicempp01.service. Finished to create the service (DmWatcherServicempp01) [root@dm8mppdw1 ~]# service DmWatcherServicempp01 start Redirecting to /bin/systemctl start DmWatcherServicempp01.service
主庫mpp02
[root@dm8mppdw2 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/mpp02/dmwatcher.ini -p mpp02 -t dmwatcher Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicempp02.service to /usr/lib/systemd/system/DmWatcherServicempp02.service. Finished to create the service (DmWatcherServicempp02) [root@dm8mppdw2 ~]# service DmWatcherServicempp02 start Redirecting to /bin/systemctl start DmWatcherServicempp02.service
備庫mpp11:
[root@dm8mppdw3 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/mpp01/dmwatcher.ini -p mpp11 -t dmwatcher Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicempp11.service to /usr/lib/systemd/system/DmWatcherServicempp11.service. Finished to create the service (DmWatcherServicempp11) [root@dm8mppdw3 ~]# service DmWatcherServicempp11 start Redirecting to /bin/systemctl start DmWatcherServicempp11.service
備庫mpp12:
[root@dm8mppdw4 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/mpp02/dmwatcher.ini -p mpp12 -t dmwatcher Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicempp12.service to /usr/lib/systemd/system/DmWatcherServicempp12.service. Finished to create the service (DmWatcherServicempp12) [root@dm8mppdw4 ~]# service DmWatcherServicempp12 start Redirecting to /bin/systemctl start DmWatcherServicempp12.service
檢視file_lsn與cur_lsn主備庫是否一致
主庫mpp01:
SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 25877 25877 used time: 3.526(ms). Execute id is 700.
主庫mpp02:
SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 25877 25877 used time: 4.583(ms). Execute id is 700.
備庫mpp11:
SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 25877 25877 used time: 1.855(ms). Execute id is 201.
備庫mpp12:
SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 25877 25877 used time: 1.987(ms). Execute id is 201.
配置監視器
由於主備庫的守護程式配置為自動切換模式,因此這裡選擇配置確認監視器。和普通監視器相比,確認監視器除了相同的命令支援外,在主庫發生故障時,能夠自動通知備庫接管為新的主庫,具有自動故障處理的功能。
修改dmmonitor.ini配置確認監視器,其中MON_DW_IP中的IP和PORT和dmmal.ini中的MAL_HOST和MAL_DW_PORT配置項保持一致。
MON_DW_CONFIRM = 1 #確認監視器模式 MON_LOG_PATH = /dm8/data/log #監視器日誌檔案存放路徑 MON_LOG_INTERVAL = 60 #每隔60s定時記錄系統資訊到日誌檔案 MON_LOG_FILE_SIZE = 32 #每個日誌檔案最大32M MON_LOG_SPACE_LIMIT = 0 #不限定日誌檔案總佔用空間 [GRP1] MON_INST_OGUID = 333333 #組GRP1的唯一OGUID值 #以下配置為監視器到組GRP1的守護程式的連線資訊,以“IP:PORT”的形式配置 #IP對應dmmal.ini中的MAL_HOST,PORT對應dmmal.ini中的MAL_DW_PORT MON_DW_IP = 10.10.13.217:5239 MON_DW_IP = 10.10.13.219:5239 [GRP2] MON_INST_OGUID = 444444 #組GRP1的唯一OGUID值 #以下配置為監視器到組GRP1的守護程式的連線資訊,以“IP:PORT”的形式配置 #IP對應dmmal.ini中的MAL_HOST,PORT對應dmmal.ini中的MAL_DW_PORT MON_DW_IP = 10.10.13.218:5239 MON_DW_IP = 10.10.13.220:5239 [dmdba@dm8mppdw5 data]$ vi dmmonitor.ini MON_DW_CONFIRM = 1 MON_LOG_PATH = /dm8/data/log MON_LOG_INTERVAL = 60 MON_LOG_FILE_SIZE = 32 MON_LOG_SPACE_LIMIT = 0 [GRP1] MON_INST_OGUID = 333333 MON_DW_IP = 10.10.13.217:5239 MON_DW_IP = 10.10.13.219:5239 [GRP2] MON_INST_OGUID = 444444 MON_DW_IP = 10.10.13.218:5239 MON_DW_IP = 10.10.13.220:5239
啟動監視器:
[dmdba@dm8mppdw5 data]$ dmmonitor /dm8/data/dmmonitor.ini [monitor] 2022-01-28 09:29:19: DMMONITOR[4.0] V8 [monitor] 2022-01-28 09:29:19: DMMONITOR[4.0] IS READY. [monitor] 2022-01-28 09:29:19: Received message from(MPP01) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-01-28 09:29:19 OPEN OK MPP01 OPEN PRIMARY VALID 2 25877 25877 [monitor] 2022-01-28 09:29:20: Received message from(MPP11) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-01-28 09:29:19 OPEN OK MPP11 OPEN STANDBY VALID 2 25877 25877 [monitor] 2022-01-28 09:29:20: Received message from(MPP02) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-01-28 09:29:19 OPEN OK MPP02 OPEN PRIMARY VALID 2 25877 25877 [monitor] 2022-01-28 09:29:20: Received message from(MPP12) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-01-28 09:29:19 OPEN OK MPP12 OPEN STANDBY VALID 2 25877 25877 show 2022-01-28 09:29:32 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 333333 TRUE AUTO TRUE < > DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 10.10.13.217 5239 2022-01-28 09:29:31 GLOBAL VALID OPEN MPP01 OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID EP INFO: INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG 10.10.13.217 5236 OK MPP01 OPEN PRIMARY 0 0 REALTIME VALID 4213 25877 4213 25877 NONE < > DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 10.10.13.219 5239 2022-01-28 09:29:31 GLOBAL VALID OPEN MPP11 OK 1 1 OPEN STANDBY DSC_OPEN REALTIME VALID EP INFO: INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG 10.10.13.219 5236 OK MPP11 OPEN STANDBY 0 0 REALTIME VALID 4207 25877 4207 25877 NONE DATABASE(MPP11) APPLY INFO FROM (MPP01), REDOS_PARALLEL_NUM (1): DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4213, 4213, 4213], (RLSN, SLSN, KLSN)[25877, 25877, 25877], N_TSK[0], TSK_MEM_USE[0] REDO_LSN_ARR: (25877) #--------------------------------------------------------------------------------# 2022-01-28 09:29:32 #--------------------------------------------------------------------------------# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP2 444444 TRUE AUTO TRUE < > DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 10.10.13.218 5239 2022-01-28 09:29:31 GLOBAL VALID OPEN MPP02 OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID EP INFO: INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG 10.10.13.218 5236 OK MPP02 OPEN PRIMARY 0 0 REALTIME VALID 4217 25877 4217 25877 NONE < > DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 10.10.13.220 5239 2022-01-28 09:29:31 GLOBAL VALID OPEN MPP12 OK 1 1 OPEN STANDBY DSC_OPEN REALTIME VALID EP INFO: INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG 10.10.13.220 5236 OK MPP12 OPEN STANDBY 0 0 REALTIME VALID 4211 25877 4211 25877 NONE DATABASE(MPP12) APPLY INFO FROM (MPP02), REDOS_PARALLEL_NUM (1): DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4217, 4217, 4217], (RLSN, SLSN, KLSN)[25877, 25877, 25877], N_TSK[0], TSK_MEM_USE[0] REDO_LSN_ARR: (25877) #================================================================================#
或者
[root@dm8mppdw5 ~]# /dm8/script/root/dm_service_installer.sh -monitor_ini /dm8/data/dmmonitor.ini -p mppdw -t dmmonitor Created symlink from /etc/systemd/system/multi-user.target.wants/DmMonitorServicemppdw.service to /usr/lib/systemd/system/DmMonitorServicemppdw.service. Finished to create the service (DmMonitorServicemppdw)
使用服務方式啟動不能執行相關命令來顯示監控資訊所以一般不使用
驗證
MPP 驗證
在MPP主節點1(mpp01)建立測試表:
[dmdba@dm8mppdw1 ~]$ disql SYSDBA/SYSDBA Server[LOCALHOST:5236]:mode is primary, state is open login used time : 3.571(ms) disql V8 SQL> create table test as select * from sysobjects; executed successfully used time: 209.673(ms). Execute id is 900.
到MPP主節點2(mpp02)查詢:MPP執行正常:
[dmdba@dm8mppdw2 mpp02]$ disql SYSDBA/SYSDBA Server[LOCALHOST:5236]:mode is primary, state is open login used time : 3.175(ms) disql V8 SQL> select count(*) from test; LINEID COUNT(*) ---------- -------------------- 1 728 used time: 9.494(ms). Execute id is 415390.
資料守護驗證
備庫mpp11:
[dmdba@dm8mppdw3 mpp01]$ disql SYSDBA/SYSDBA@LOCALHOST:5236 Server[LOCALHOST:5236]:mode is standby, state is open login used time : 2.944(ms) disql V8 SQL> select count(*) from test; LINEID COUNT(*) ---------- -------------------- 1 728 used time: 6.369(ms). Execute id is 300.
備庫mpp12:
SQL> select count(*) from test; LINEID COUNT(*) ---------- -------------------- 1 0 used time: 0.310(ms). Execute id is 201.
確認下守護程式的資訊,執行是正常的:
備庫mpp11:
SQL> select * from v$dmwatcher; LINEID N_GROUP GROUP_NAME INST_NAME DW_TYPE DW_MODE AUTO_RESTART DW_STATUS DW_SUB_STATUS LAST_MSG_TIME SWITCH_COUNT CTL_NUM INST_NUM MAX_CONN_NUM ---------- ----------- ---------- --------- ------- ------- ------------ --------- --------------- -------------------------- ------------ ----------- ----------- ------------ 1 1 GRP1 MPP11 GLOBAL AUTO 1 OPEN SUB_STATE_START 2022-01-28 11:08:34.000000 0 1 1 2 used time: 1.327(ms). Execute id is 203. SQL> select * from v$mal_link_status; LINEID SRC_SITE DEST_SITE CTL_LINK_STATUS DATA_LINK_STATUS ---------- -------- --------- --------------- ---------------- 1 MPP11 MPP01 CONNECTED CONNECTED 2 MPP11 MPP02 CONNECTED CONNECTED 3 MPP11 MPP12 CONNECTED CONNECTED used time: 0.798(ms). Execute id is 204.
備庫mpp12:
SQL> select * from v$dmwatcher; LINEID N_GROUP GROUP_NAME INST_NAME DW_TYPE DW_MODE AUTO_RESTART DW_STATUS DW_SUB_STATUS LAST_MSG_TIME SWITCH_COUNT CTL_NUM INST_NUM MAX_CONN_NUM ---------- ----------- ---------- --------- ------- ------- ------------ --------- --------------- -------------------------- ------------ ----------- ----------- ------------ 1 1 GRP2 MPP12 GLOBAL AUTO 1 OPEN SUB_STATE_START 2022-01-28 11:08:30.000000 0 1 1 2 used time: 1.383(ms). Execute id is 203. SQL> select * from v$mal_link_status; LINEID SRC_SITE DEST_SITE CTL_LINK_STATUS DATA_LINK_STATUS ---------- -------- --------- --------------- ---------------- 1 MPP12 MPP01 CONNECTED CONNECTED 2 MPP12 MPP02 CONNECTED CONNECTED 3 MPP12 MPP11 CONNECTED CONNECTED used time: 0.986(ms). Execute id is 204.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2882259/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DM8 MPP主備環境搭建
- DM8搭建MPP叢集
- DM8 配置DMDSC主備環境(rac到單節點 )
- DM8配置非同步備庫非同步
- DM8 實時主備環境搭建
- DM8 資料守護實時主備搭建
- MySQL備份與主備配置MySql
- 達夢資料庫DM8主備叢集測試記錄資料庫
- MySQL主從配置及mysqldump備份MySql
- 使用nmcli配置主備模式鏈路聚合模式
- DM8 Linux環境下配置ODBCLinux
- DM8配置讀寫分離叢集
- 達夢資料庫(DM8)大規模並行叢集MPP 2節點安裝部署資料庫並行
- MySQL 主備MySql
- DM8配置讀寫分離叢集V4.0
- DM8資料庫備份還原的原理及應用資料庫
- keepalived 主備使用
- 達夢8MPP叢集(2節點+順序備)linux下部署Linux
- MPP 資料庫資料庫
- redis主從備份Redis
- mysql主從和主備的區別MySql
- 主備都是全新的恢復,主主搭建步驟
- Redis主從配置Redis
- Mongodb主從配置MongoDB
- mysql主從配置MySql
- Centos Mysql 主從備份CentOSMySql
- MySQL 主從配置-之-一主一從MySql
- docker 配置 Redis 主從DockerRedis
- mysql 5.7主從配置MySql
- MySQL主從同步配置MySql主從同步
- docker mysql 主從配置DockerMySql
- DM8 日誌挖掘
- 前端必備 Nginx 配置前端Nginx
- Notepad++配置備份
- Oracle DG異構主備支援Oracle
- 分散式Redis主備複製分散式Redis
- mpp檔案用什麼軟體開啟 如何開啟mpp格式檔案
- Docker配置redis主從哨兵DockerRedis