您好,登錄后才能下訂單哦!
這篇文章主要介紹DM7如何搭建數(shù)據(jù)守護(hù),文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
數(shù)據(jù)守護(hù)(DG)
環(huán)境說(shuō)明
下列機(jī)器事先都安裝了DM軟件,安裝路徑為/dm7,執(zhí)行程序保存在/dm7/bin目錄中,數(shù)據(jù)存放路徑為/dm7/data
機(jī)器名 IP地址 初始狀態(tài) 操作系統(tǒng) 19c1 10.13.13.141(對(duì)外) 主庫(kù) dm1 redhat 6.7 10.10.10.141(mal對(duì)內(nèi)) 19c2 10.13.13.142(對(duì)外) 10.10.10.142(mal對(duì)內(nèi)) 備庫(kù) dm2 redhat 6.7 ora19c 10.13.13.140 確認(rèn)監(jiān)視器 redhat 6.7 實(shí)例名 port_num dw_port mal_host mal_port mal_dw_port dm1 5236 5239 10.10.10.141 5237 5238 dm2 5236 5239 10.10.10.142 5237 5238
數(shù)據(jù)準(zhǔn)備
在主庫(kù)機(jī)器上初始化數(shù)據(jù)庫(kù)到目錄/dm7/data:
[dmdba@19c1 bin]$ ./dminit path=/dm7/data db_name=DAMENG instance_name=DM1 port_num=5236 page_size=8 charset=0 initdb V7.1.6.46-Build(2018.02.08-89107)ENT db version: 0x7000a file dm.key not found, use default license! License will expire in 14 day(s) on 2020-06-17 log file path: /dm7/data/DAMENG/DAMENG01.log log file path: /dm7/data/DAMENG/DAMENG02.log write to dir [/dm7/data/DAMENG]. create dm database success. 2020-06-03 02:55:43
注冊(cè)服務(wù)用于啟動(dòng)數(shù)據(jù)庫(kù)
[root@19c1 root]# ./dm_service_installer.sh -i /dm7/data/DAMENG/dm.ini -p DM1 -t dmserver ln -s '/usr/lib/systemd/system/DmServiceDM1.service' '/etc/systemd/system/multi-user.target.wants/DmServiceDM1.service' Finished to create the service (DmServiceDM1)
正常啟動(dòng)數(shù)據(jù)庫(kù)并正常關(guān)閉
[root@19c1 root]# service DmServiceDM1 start Redirecting to /bin/systemctl start DmServiceDM1.service [root@19c1 root]# ps -ef | grep dmserver dmdba 21312 1 14 02:59 ? 00:00:03 /dm7/bin/dmserver /dm7/data/DAMENG/dm.ini -noconsole root 21536 18668 0 03:00 pts/2 00:00:00 grep --color=auto dmserver [dmdba@19c1 bin]$ ./disql SYSDBA/SYSDBA Server[LOCALHOST:5236]:mode is normal, state is open login used time: 5.903(ms) disql V7.1.6.46-Build(2018.02.08-89107)ENT Connected to: DM 7.1.6.46 SQL> exit [root@19c1 root]# service DmServiceDM1 stop Redirecting to /bin/systemctl stop DmServiceDM1.service
ARCH_INI=1(打開(kāi)歸檔)
MAL_INI=1(打開(kāi)MAL配置)
DW_PORT=5239 (DW端口)
配置dmmal.ini文件
配置MAL系統(tǒng),各主備庫(kù)的dmmal.ini配置必須完全一致,MAL_HOST使用內(nèi)部網(wǎng)絡(luò)IP,MAL_PORT與dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各實(shí)例對(duì)應(yīng)的守護(hù)進(jìn)程之間,以及守護(hù)進(jìn)程和監(jiān)視器之間的通信端口,配置如下:
[dmdba@19c1 DAMENG]$ vi dmmal.ini MAL_CHECK_INTERVAL = 5 MAL_CONN_FAIL_INTERVAL = 5 [MAL_INST1] MAL_INST_NAME = DM1 MAL_HOST = 10.10.10.141 MAL_PORT = 5237 MAL_INST_HOST = 10.13.13.141 MAL_INST_PORT = 5236 MAL_DW_PORT = 5238 [MAL_INST2] MAL_INST_NAME = DM2 MAL_HOST = 10.10.10.142 MAL_PORT = 5237 MAL_INST_HOST = 10.13.13.142 MAL_INST_PORT = 5236 MAL_DW_PORT = 5238
配置dmarch.ini
修改dmarch.ini,配置本地歸檔和實(shí)時(shí)歸檔。除了本地歸檔外,其他歸檔配置項(xiàng)中的ARCH_DEST表示實(shí)例是Primary模式時(shí),需要同步歸檔數(shù)據(jù)的目標(biāo)實(shí)例名。當(dāng)前實(shí)例DM1是主庫(kù),需要向DM2(實(shí)時(shí)備庫(kù))同步數(shù)據(jù),因此實(shí)時(shí)歸檔的ARCH_DEST配置為DM2。
[dmdba@19c1 DAMENG]$ vi dmarch.ini [ARCHIVE_REALTIME] ARCH_TYPE = REALTIME ARCH_DEST = DM2 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /dm7/data/DAMENG/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0
配置dmwatcher.ini
修改dmwatcher.ini配置守護(hù)進(jìn)程,配置為全局守護(hù)類(lèi)型,使用自動(dòng)切換模式。
[dmdba@19c1 DAMENG]$ vi dmwatcher.ini [GRP1] DW_TYPE = GLOBAL DW_MODE = AUTO DW_ERROR_TIME = 10 INST_RECOVER_TIME = 60 INST_ERROR_TIME = 10 INST_OGUID = 453331 INST_INI = /dm7/data/DAMENG/dm.ini INST_AUTO_RESTART = 1 INST_STARTUP_CMD = /dm7/bin/dmserver RLOG_SEND_THRESHOLD = 0 RLOG_APPLY_THRESHOLD = 0
配置dmwatcher.ctl
同一個(gè)守護(hù)進(jìn)程組,必須使用同一份dmwatcher.ctl。因此,只需要使用dmctlcvt工具生成一份dmwatcher.ctl文件,然后分別拷貝到各個(gè)數(shù)據(jù)庫(kù)目錄下即可。在配置完成dmwatcher.ini后,使用dmctlcvt工具生成dmwatcher.ctl:(特別注意,DEST目錄為DAMENG的上一級(jí)目錄,否則不生成控制文件)
[dmdba@19c1 bin]$ ./dmctlcvt TYPE=3 SRC=/dm7/data/DAMENG/dmwatcher.ini DEST=/dm7/data DMCTLCVT V7.1.6.46-Build(2018.02.08-89107)ENT convert txt to ctl success!
會(huì)在/dm7/data目錄中生成一個(gè)GRP1目錄,在GRP1目錄中生成了dmwatcher.ctl控制文件
[root@19c1 data]# ls -lrt total 4 drwxr-xr-x 8 dmdba dinstall 4096 Jun 3 03:44 DAMENG drwxr-xr-x 2 dmdba dinstall 26 Jun 3 03:53 GRP1 [root@19c1 data]# cd GRP1 [root@19c1 GRP1]# ls -lrt total 4 -rw-r--r-- 1 dmdba dinstall 512 Jun 3 03:53 dmwatcher.ctl
拷貝生成的dmwatcher.ctl文件到數(shù)據(jù)文件目錄/dm7/data/DAMENG。
將主庫(kù)相關(guān)文件傳輸?shù)絺錂C(jī):
[dmdba@19c1 dm7]$ scp -r data/ dmdba@10.13.13.142:/dm7/ The authenticity of host '10.13.13.142 (10.13.13.142)' can't be established. ECDSA key fingerprint is 7f:1f:9a:0f:8b:d1:e0:17:32:08:12:73:d8:1d:9c:da. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.13.13.142' (ECDSA) to the list of known hosts. dmdba@10.13.13.142's password: dminit20200603025444.log 100% 783 0.8KB/s 00:00 sqllog.ini 100% 479 0.5KB/s 00:00 dm.ctl 100% 5120 5.0KB/s 00:00 DAMENG01.log 100% 256MB 256.0MB/s 00:01 DAMENG02.log 100% 256MB 128.0MB/s 00:02 dm_20200603025543_320471.ctl 100% 5120 5.0KB/s 00:00 dm_20200603030017_373808.ctl 100% 5120 5.0KB/s 00:00 SYSTEM.DBF 100% 21MB 21.0MB/s 00:01 dm_service.prikey 100% 633 0.6KB/s 00:00 MAIN.DBF 100% 128MB 128.0MB/s 00:01 ROLL.DBF 100% 128MB 128.0MB/s 00:01 dminst.sys 100% 220 0.2KB/s 00:00 TEMP.DBF 100% 10MB 10.0MB/s 00:00 rep_conflict.log 100% 12 0.0KB/s 00:00 dm.ini 100% 40KB 39.8KB/s 00:00 dmmal.ini 100% 558 0.5KB/s 00:00 dmarch.ini 100% 367 0.4KB/s 00:00 dmwatcher.ini 100% 615 0.6KB/s 00:00 dmwatcher.ctl 100% 512 0.5KB/s 00:00
備機(jī)修改相關(guān)配置
修改dm.ini INSTANCE_NAME = DM2
修改dmarch.ini
ARCH_DEST = DM1
其中dmwatcher.ini,dmmal.ini,dmwatcher.ctl和主庫(kù)一致
二:啟動(dòng)到mount狀態(tài)設(shè)置oguid
主庫(kù)
[dmdba@19c1 bin]$ ./dmserver /dm7/data/DAMENG/dm.ini mount file dm.key not found, use default license! version info: develop Use normal os_malloc instead of HugeTLB Use normal os_malloc instead of HugeTLB DM Database Server x64 V7.1.6.46-Build(2018.02.08-89107)ENT startup... License will expire in 14 day(s) on 2020-06-17 ckpt lsn: 32981 SYSTEM IS READY. [dmdba@19c1 bin]$ ./disql SYSDBA/SYSDBA Server[LOCALHOST:5236]:mode is normal, state is mount login used time: 6.020(ms) disql V7.1.6.46-Build(2018.02.08-89107)ENT Connected to: DM 7.1.6.46 SQL> sp_set_oguid(453331); DMSQL executed successfully used time: 38.995(ms). Execute id is 1. SQL> exit
備庫(kù)
[dmdba@19c2 bin]$ ./dmserver /dm7/data/DAMENG/dm.ini mount file dm.key not found, use default license! version info: develop Use normal os_malloc instead of HugeTLB Use normal os_malloc instead of HugeTLB DM Database Server x64 V7.1.6.46-Build(2018.02.08-89107)ENT startup... License will expire in 14 day(s) on 2020-06-17 ckpt lsn: 32981 SYSTEM IS READY. [dmdba@19c2 bin]$ ./disql SYSDBA/SYSDBA Server[LOCALHOST:5236]:mode is normal, state is mount login used time: 6.005(ms) disql V7.1.6.46-Build(2018.02.08-89107)ENT Connected to: DM 7.1.6.46 SQL> sp_set_oguid(453331); DMSQL executed successfully used time: 46.333(ms). Execute id is 1.
注冊(cè)服務(wù)用于啟動(dòng)數(shù)據(jù)庫(kù)
[root@19c2 root]# ./dm_service_installer.sh -i /dm7/data/DAMENG/dm.ini -p DM2 -t dmserver ln -s '/usr/lib/systemd/system/DmServiceDM2.service' '/etc/systemd/system/multi-user.target.wants/DmServiceDM2.service' Finished to create the service (DmServiceDM2)
三:打開(kāi)數(shù)據(jù)庫(kù)
主庫(kù)以primary打開(kāi)
SQL> alter database primary; executed successfully used time: 37.838(ms). Execute id is 0.
備庫(kù)以standby 打開(kāi)
SQL> alter database standby; executed successfully used time: 39.682(ms). Execute id is 0.
四:啟動(dòng)守護(hù)進(jìn)程
啟動(dòng)各個(gè)主備庫(kù)上的守護(hù)進(jìn)程:
主庫(kù)
[dmdba@19c1 bin]$ ./dmwatcher /dm7/data/DAMENG/dmwatcher.ini DMWATCHER[2.1] V7.1.6.46-Build(2018.02.08-89107)ENT DMWATCHER[2.1] IS READY
備庫(kù)
[dmdba@19c2 bin]$ ./dmwatcher /dm7/data/DAMENG/dmwatcher.ini DMWATCHER[2.1] V7.1.6.46-Build(2018.02.08-89107)ENT DMWATCHER[2.1] IS READY 五:查看file_lsn與cur_lsn主備庫(kù)是否一致 主庫(kù)
SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 34412 34412 used time: 1.203(ms). Execute id is 6.
備庫(kù)
SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 34412 34412 used time: 1.228(ms). Execute id is 3.
測(cè)試數(shù)據(jù)同步
主庫(kù):
SQL> create table t1(id int); executed successfully used time: 18.410(ms). Execute id is 7. SQL> insert into t1 values(1); affect rows 1 used time: 0.890(ms). Execute id is 8. SQL> commit; executed successfully used time: 6.026(ms). Execute id is 9. SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 34443 34443 used time: 0.340(ms). Execute id is 10.
備庫(kù):
SQL> select file_LSN, cur_LSN from v$rlog; LINEID FILE_LSN CUR_LSN ---------- -------------------- -------------------- 1 34443 34443 used time: 0.363(ms). Execute id is 4. SQL> select * from t1; LINEID ID ---------- ----------- 1 1 used time: 1.213(ms). Execute id is 5.
六:配置監(jiān)視器(基本要求,安裝dm7的軟件)
由于主庫(kù)和實(shí)時(shí)備庫(kù)的守護(hù)進(jìn)程配置為自動(dòng)切換模式,因此這里選擇配置確認(rèn)監(jiān)視器。和普通監(jiān)視器相比,確認(rèn)監(jiān)視器除了相同的命令支持外,在主庫(kù)發(fā)生故障時(shí),能夠自動(dòng)通知實(shí)時(shí)備庫(kù)接管為新的主庫(kù),具有自動(dòng)故障處理的功能。
修改dmmonitor.ini配置確認(rèn)監(jiān)視器,其中MON_DW_IP中的IP和PORT和dmmal.ini中的MAL_HOST和MAL_DW_PORT配置項(xiàng)保持一致。
[dmdba@ora19c data]$ vi dmmonitor.ini MON_DW_CONFIRM = 1 MON_LOG_PATH = /dm7/data/log MON_LOG_INTERVAL = 60 MON_LOG_FILE_SIZE = 32 MON_LOG_SPACE_LIMIT = 0 [GRP1] MON_INST_OGUID = 453331 MON_DW_IP = 10.10.10.141:5238 MON_DW_IP = 10.10.10.142:5238
啟動(dòng)監(jiān)視器:
[dmdba@ora19c bin]$ ./dmmonitor /dm7/data/dmmonitor.ini [monitor] 2020-06-03 09:18:20: DMMONITOR[2.1] V7.1.6.46-Build(2018.02.08-89107)ENT [monitor] 2020-06-03 09:18:20: DMMONITOR[2.1] IS READY. [monitor] 2020-06-03 09:18:20: Received message from(DM1) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN SSLSN SLSN 2020-06-03 04:35:58 OPEN OK DM1 OPEN PRIMARY VALID 2 34443 34443 34443 34443 [monitor] 2020-06-03 09:18:20: Received message from(DM2) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN SSLSN SLSN 2020-06-03 04:35:58 OPEN OK DM2 OPEN STANDBY VALID 2 34443 34443 34443 34443
以上是“DM7如何搭建數(shù)據(jù)守護(hù)”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。