本篇为DMDSC集群主备搭建部署文档。主库为DMDSC集群,备库为单节点实例。
主机规划:
IP Addr | 数据库实例 | 数据库版本 | OS | |
---|---|---|---|---|
Primary Node1 | 192.168.15.40(外部) 192.168.25.40(内部) |
RAC0 | 达梦8 | Centos 7.8 |
Primary Node2 | 192.168.15.41(外部) 192.168.25.41(内部) |
RAC1 | 达梦8 | Centos 7.8 |
Standby | 192.168.15.33(外部) 192.168.25.33(内部) |
RAC_STB | 达梦8 | Centos 7.8 |
监视器 | 192.168.15.10 192.168.25.10 |
- | 达梦8 | 中标麒麟6 |
端口规划:
实例名 | PORT_NUM | MAL_INST_DW_PORT | MAL_HOST | MAL_PORT | MAL_DW_PORT |
---|---|---|---|---|---|
RAC0 | 5236 | 4567 | 192.168.25.40 | 9340 | 3567 |
RAC1 | 5236 | 4568 | 192.168.25.41 | 9341 | 3568 |
RAC_STB | 5236 | 4569 | 192.168.25.33 | 8340 | 5538 |
参考 DM8 DSC共享集群搭建部署
注意 :
dmcss 对 dmserver 的自动拉起功能先不要打开,避免影响到配置过程。
搭建完成后,正常关闭 DMDSC 集群的两个 dmserver 节点实例,不需要退出 dmcss和 dmasmsvr。
配置主库所有节点和单节点dm.ini文件,修改数据守护相关词参数。
除了数据库实例名和实例监听端口可以根据实际情况决定是否更改外,其他参数需要检查并修改。
节点1:
INSTANCE_NAME = RAC0 #数据库实例名
PORT_NUM = 5236 #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60 #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0 #不允许手工方式修改实例模式/状态/OGUID
ENABLE_OFFLINE_TS = 2 #不允许备库OFFLINE表空间
MAL_INI = 1 #打开MAL系统
ARCH_INI = 1 #打开归档配置
RLOG_SEND_APPLY_MON = 64 #统计最近64次的日志发送信息
节点2:
INSTANCE_NAME = RAC1 #数据库实例名
PORT_NUM = 5236 #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60 #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0 #不允许手工方式修改实例模式/状态/OGUID
ENABLE_OFFLINE_TS = 2 #不允许备库OFFLINE表空间
MAL_INI = 1 #打开MAL系统
ARCH_INI = 1 #打开归档配置
RLOG_SEND_APPLY_MON = 64 #统计最近64次的日志发送信息
配置本地归档、远程归档、实时归档。
节点1 dmarch.ini:
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm/data/dmarch/rac0_arch
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 10240
[ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = RAC1
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 10240
ARCH_INCOMING_PATH = /dm/data/dmarch/arch_remote
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = RAC_STB
节点2 dmarch.ini:
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm/data/dmarch/rac1_arch
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 10240
[ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = RAC0
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 10240
ARCH_INCOMING_PATH = /dm/data/dmarch/arch_remote
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = RAC_STB
./dmrman use_ap=2 dcr_ini=/dm/data/dmdsc/dmdcr.ini
backup database ‘/dm/data/dsc0_config/dm.ini’ full backupset ‘/dm/dmbak/db_full_dsc’;
[dmdba@dm8dw01 bin]$ ./dmrman use_ap=2 dcr_ini=/dm/data/dmdsc/dmdcr.ini
dmrman V8
RMAN>
RMAN> backup database '/dm/data/dsc0_config/dm.ini' full backupset '/dm/dmbak/db_full_dsc';
backup database '/dm/data/dsc0_config/dm.ini' full backupset '/dm/dmbak/db_full_dsc';
file dm.key not found, use default license!
checking if the DSC database under system path [+DMDATA/data/dsc] is running with vote disk....
EP [0] is checking....
EP [1] is checking....
Database mode = 0, oguid = 0
EP[0]'s cur_lsn[51046]
EP[1]'s cur_lsn[51046]
EP[0] adjust cur_lsn from [51046] to [51046]
BACKUP DATABASE [dsc],execute......
CMD CHECK LSN......
BACKUP DATABASE [dsc],collect dbf......
CMD CHECK ......
DBF BACKUP SUBS......
total 1 packages processed...
total 2 packages processed...
total 3 packages processed...
DBF BACKUP MAIN......
BACKUPSET [/dm/dmbak/db_full_dsc] END, CODE [0]......
EP(0) slot ctl page(1, 0, 16) trxid[3008], pseg_state[0]
META GENERATING......
file [db_full_dsc.bak] finished, name:[db_full_dsc.bak],created time:[2020-06-13 21:30:26],expire time:[2105-12-31 23:59:59],label:[],comment:[]
file [db_full_dsc.meta] finished, name:[db_full_dsc.meta],created time:[2020-06-13 21:30:26],expire time:[2105-12-31 23:59:59],label:[],comment:[]
total 5 packages processed...
total 5 packages processed...
total 5 packages processed!
CMD END.CODE:[0]
backup successfully!
time used: 00:00:36.313
RMAN>
在DMDSC集群的dmmal.ini文件基础上,增加备库RAC_STB的配置项。
所有节点实例的dmmal.ini文件内容是一致的,配置完成后,拷贝到每个节点实例dm.ini 中指定的 CONFIG_PATH 目录下。
所有主备库节点dmmal.ini:
MAL_CHECK_INTERVAL = 30 #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 10 #判定MAL链路断开的时间
[MAL_INST0]
MAL_INST_NAME = RAC0 #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 192.168.25.11 #MAL系统监听TCP连接的IP地址
MAL_PORT = 9340 #MAL系统监听TCP连接的端口
MAL_INST_HOST = 192.168.15.11 #实例的对外服务IP地址
MAL_INST_PORT = 5236 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 3567 #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 4567 #实例监听守护进程TCP连接的端口
[MAL_INST1]
MAL_INST_NAME = RAC1
MAL_HOST = 192.168.25.12
MAL_PORT = 9341
MAL_INST_HOST = 192.168.15.12
MAL_INST_PORT = 5236
MAL_DW_PORT = 3568
MAL_INST_DW_PORT = 4568
[MAL_INST2]
MAL_INST_NAME = RAC_STB
MAL_HOST = 192.168.25.33
MAL_PORT = 8340
MAL_INST_HOST = 192.168.15.33
MAL_INST_PORT = 5236
MAL_DW_PORT = 3569
MAL_INST_DW_PORT = 4569
依次配置每个节点实例 dmwatcher.ini文件,放到各自dm.ini中指定的CONFIG_PATH目录下。
需要注意:
DMDSC集群各节点实例的自动拉起是由各自本地的dmcss执行的,不是由守护进程执行。
节点1 dmwatcher.ini:
[GRP1]
DW_TYPE = GLOBAL #全局守护类型
DW_MODE = MANUAL #手动切换模式
DW_ERROR_TIME = 60 #远程守护进程故障认定时间
INST_RECOVER_TIME = 60 #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 35 #本地实例故障认定时间
INST_INI = /dm/data/dsc0_config/dm.ini #dm.ini 配置文件路径
DCR_INI = /dm/data/dmdsc/dmdcr.ini #dmdcr.ini 配置文件路径
INST_OGUID = 43333 #守护系统唯一OGUID值
INST_STARTUP_CMD = /dm/dmdbms/bin/dmserver #命令行方式启动
INST_AUTO_RESTART = 0 #关闭实例的自动启动功能
RLOG_SEND_THRESHOLD = 0 #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0 #指定备库重演日志的时间阀值,默认关闭
节点2 dmwatcher.ini:
[GRP1]
DW_TYPE = GLOBAL #全局守护类型
DW_MODE = MANUAL #手动切换模式
DW_ERROR_TIME = 60 #远程守护进程故障认定时间
INST_RECOVER_TIME = 60 #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 30 #本地实例故障认定时间
INST_INI = /dm/data/dsc1_config/dm.ini #dm.ini 配置文件路径
DCR_INI = /dm/data/dmdsc/dmdcr.ini #dmdcr.ini 配置文件路径
INST_OGUID = 43333 #守护系统唯一OGUID值
INST_STARTUP_CMD = /dm/dmdbms/bin/dmserver #命令行方式启动
INST_AUTO_RESTART = 0 #关闭实例的自动启动功能
RLOG_SEND_THRESHOLD = 0 #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0 #指定备库重演日志的时间阀值,默认关闭
DMDSC集群中dmserver的自动拉起是由dmcss执行的,需要修改dmdcr.ini中的自动拉起配置参数DMDCR_DB_RESTART_INTERVAL,此参数修改完成后,需要重启dmcss才可以生效。如果不需要打开dmcss的自动拉起功能,则可以不配置。
另外,如果是用服务方式启动,服务脚本中也一定要指定以Mount方式拉起dmserver。
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/dm/data/dmdsc/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 0
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL = 60
DMDCR_ASM_STARTUP_CMD = /dm/dmdbms/bin/dmasmsvr dcr_ini=/dm/data/dmdsc/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 60
DMDCR_DB_STARTUP_CMD = /dm/dmdbms/bin/dmserver path=/dm/data/dsc0_config/dm.ini dcr_ini=/dm/data/dmdsc/dmdcr.ini mount
软件安装,参考之前文章。
初始化实例:
[dmdba@localhost bin]$ ./dminit path=/dm/data/RAC_STB
initdb V8
db version: 0x7000a
file dm.key not found, use default license!
License will expire on 2021-06-01
log file path: /dm/data/RAC_STB/DAMENG/DAMENG01.log
log file path: /dm/data/RAC_STB/DAMENG/DAMENG02.log
write to dir [/dm/data/RAC_STB/DAMENG].
create dm database success. 2020-06-13 22:15:05
[dmdba@localhost bin]$
从主库拷贝备份集文件到备库。
DMRMAN还原:
./dmrman use_ap=2
restore database ‘/dm/data/RAC_STB/DAMENG/dm.ini’ from backupset ‘/dm/dmbak/db_full_dsc’;
recover database ‘/dm/data/RAC_STB/DAMENG/dm.ini’ from backupset ‘/dm/dmbak/db_full_dsc’;
recover database ‘/dm/data/RAC_STB/DAMENG/dm.ini’ update db_magic;
[dmdba@localhost bin]$ ./dmrman use_ap=2
dmrman V8
----------------------------------------
RMAN> restore database '/dm/data/RAC_STB/DAMENG/dm.ini' from backupset '/dm/dmbak/db_full_dsc';
restore database '/dm/data/RAC_STB/DAMENG/dm.ini' from backupset '/dm/dmbak/db_full_dsc';
file dm.key not found, use default license!
RESTORE DATABASE CHECK......
RESTORE DATABASE,data collect......
RESTORE DATABASE,database refresh ......
RESTORE BACKUPSET [/dm/dmbak/db_full_dsc] START......
total 0 packages processed...
RESTORE DATABASE,UPDATE ctl file......
RESTORE DATABASE,REBUILD key file......
RESTORE DATABASE,CHECK db info......
RESTORE DATABASE,UPDATE db info......
total 5 packages processed!
CMD END.CODE:[0]
restore successfully.
time used: 00:00:01.190
----------------------------------------
RMAN> recover database '/dm/data/RAC_STB/DAMENG/dm.ini' from backupset '/dm/dmbak/db_full_dsc';
recover database '/dm/data/RAC_STB/DAMENG/dm.ini' from backupset '/dm/dmbak/db_full_dsc';
Database mode = 0, oguid = 0
EP[0]'s cur_lsn[51046]
RESTORE RLOG CHECK......
CMD END.CODE:[603],DESC:[备份集[/dm/dmbak/db_full_dsc]备份过程中未产生日志]
备份集[/dm/dmbak/db_full_dsc]备份过程中未产生日志
EP(0) slot ctl page(1, 0, 16) trxid[3008], pseg_state[0]
recover successfully!
time used: 267.733(ms)
----------------------------------------
RMAN> recover database '/dm/data/RAC_STB/DAMENG/dm.ini' update db_magic;
recover database '/dm/data/RAC_STB/DAMENG/dm.ini' update db_magic;
Database mode = 0, oguid = 0
EP[0]'s cur_lsn[51046]
EP[0]'s apply_lsn[51046] >= end_lsn[51046]
EP[1]'s apply_lsn[51046] >= end_lsn[51046]
EP(0) slot ctl page(1, 0, 16) trxid[3008], pseg_state[0]
recover successfully!
time used: 981.599(ms)
----------------------------------------
修改相关参数。
INSTANCE_NAME = RAC_STB
PORT_NUM = 5236
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64
DMDSC 集群可以作为主库,也可以作为实时备库、即时备库或者异步备库,当DMDSC集群作为备库配置在数据守护系统中时,要将DMDSC集群作为一个整体配置在源库的dmarch.ini 中,也就是 DMDSC 集群所有节点要配置在同一个归档配置项中,每个节点实例名以“/”分隔开来。
单节点备库dmarch.ini:
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm/data/RAC_STB/DAMENG/arch
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 10240
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = RAC0/RAC1
从主库拷贝dmmal.ini文件到备库。
dmmal.ini :
MAL_CHECK_INTERVAL = 30 #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 10 #判定MAL链路断开的时间
[MAL_INST0]
MAL_INST_NAME = RAC0 #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 192.168.25.11 #MAL系统监听TCP连接的IP地址
MAL_PORT = 9340 #MAL系统监听TCP连接的端口
MAL_INST_HOST = 192.168.15.11 #实例的对外服务IP地址
MAL_INST_PORT = 5236 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 3567 #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 4567 #实例监听守护进程TCP连接的端口
[MAL_INST1]
MAL_INST_NAME = RAC1
MAL_HOST = 192.168.25.12
MAL_PORT = 9341
MAL_INST_HOST = 192.168.15.12
MAL_INST_PORT = 5236
MAL_DW_PORT = 3568
MAL_INST_DW_PORT = 4568
[MAL_INST2]
MAL_INST_NAME = RAC_STB
MAL_HOST = 192.168.25.33
MAL_PORT = 8340
MAL_INST_HOST = 192.168.15.33
MAL_INST_PORT = 5236
MAL_DW_PORT = 3569
MAL_INST_DW_PORT = 4569
OGUID要与主库一致。
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = MANUAL
DW_ERROR_TIME = 60
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 35
INST_INI = /dm/data/RAC_STB/DAMENG/dm.ini
INST_OGUID = 43333
INST_STARTUP_CMD = /dm/dmdbms/bin/dmserver
INST_AUTO_RESTART = 1 #对单节点,如果需要打开自动拉起功能,将此配置修改为1即可
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
dmcss、dmasm已启动,这里可以先同时手动命令行启动主库两节点dmserver:
[dmdba@dm8dw01 bin]$ ./dmserver /dm/data/dsc0_config/dm.ini dcr_ini=/dm/data/dmdsc/dmdcr.ini mount
[dmdba@dm8dw02 bin]$ ./dmserver /dm/data/dsc1_config/dm.ini dcr_ini=/dm/data/dmdsc/dmdcr.ini mount
---查看lsn
[dmdba@dm8dw01 bin]$ ./disql
disql V8
用户名:
密码:
服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间: 8.784(毫秒)
SQL> select file_lsn,cur_lsn from v$rlog;
行号 FILE_LSN CUR_LSN
---------- -------------------- --------------------
1 51046 51046
[dmdba@localhost bin]$ ./dmserver /dm/data/RAC_STB/DAMENG/dm.ini mount
---查看lsn
[dmdba@localhost bin]$ ./disql
disql V8
用户名:
密码:
服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间: 4.723(毫秒)
SQL> select file_lsn,cur_lsn from v$rlog;
行号 FILE_LSN CUR_LSN
---------- -------------------- --------------------
1 51046 51046
已用时间: 13.319(毫秒). 执行号:1.
连接DMDSC集群中的任意一个节点,设置DMDSC主库的OGUID 值.
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
sp_set_oguid(43333);
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
alter database primary;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
sp_set_oguid(43333);
alter database standby;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
主库:
节点1:
[dmdba@dm8dw01 bin]$ ./dmwatcher /dm/data/dsc0_config/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
[!!! Local dmwatcher's INST_ERROR_TIME(30) configured in dmwatcher.ini is smaller than (MIN(DCR_GRP_DSKCHK_CNT, MAL_CHECK_INTERVAL) + 5), adjust it to 35 in memory !!!]
节点2:
[dmdba@dm8dw02 bin]$ ./dmwatcher /dm/data/dsc1_config/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
[!!! Local dmwatcher's INST_ERROR_TIME(30) configured in dmwatcher.ini is smaller than (MIN(DCR_GRP_DSKCHK_CNT, MAL_CHECK_INTERVAL) + 5), adjust it to 35 in memory !!!]
##警告可以先忽略,稍候将dmwatcher.ini中的INST_ERROR_TIME设置为至少35后重启dmwatcher即可。
##在DMDSC集群中,dmwatcher.ini配置项INST_ERROR_TIME的值,应设置为DCR_GRP_DSKCHK_CNT与MAL_CHECK_INTERVAL中最小值+5
备库:
[dmdba@localhost bin]$ ./dmwatcher /dm/data/RAC_STB/DAMENG/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
在监视器服务器上配置dmcssm.ini文件:
CSSM_OGUID = 63635
#配置所有 CSS 的连接信息,
#和 dmdcr_cfg.ini 中 CSS 配置项的 DCR_EP_HOST 和 DCR_EP_PORT 保持一致
CSSM_CSS_IP = 192.168.25.40:9341
CSSM_CSS_IP = 192.168.25.41:9343
CSSM_LOG_PATH =/dm8/monitor/log #监视器日志文件存放路径
CSSM_LOG_FILE_SIZE = 32 #每个日志文件最大 32M
CSSM_LOG_SPACE_LIMIT = 0 #不限定日志文件总占用空间
启动dmcssm监视器:
[dmdba@DaMengDB bin]$ ./dmcssm ini_path=/dm8/monitor/dmcssm.ini
[monitor] 2020-06-14 11:56:21: CSS MONITOR V8
[monitor] 2020-06-14 11:56:21: CSS MONITOR SYSTEM IS READY.
[monitor] 2020-06-14 11:56:21: Wait CSS Control Node choosed...
[monitor] 2020-06-14 11:56:22: Wait CSS Control Node choosed succeed.
show
monitor current time:2020-06-14 11:58:06, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================
[CSS0] global info:
[ASM0] auto restart = TRUE
[RAC0] auto restart = FALSE
[CSS1] global info:
[ASM1] auto restart = TRUE
[RAC1] auto restart = FALSE
ep: css_time inst_name seqno port mode inst_status vtd_status is_ok active guid ts
2020-06-14 11:58:06 CSS0 0 9341 Control Node OPEN WORKING OK TRUE 666876534 666878081
2020-06-14 11:58:06 CSS1 1 9343 Normal Node OPEN WORKING OK TRUE 666877858 666879398
=================== group[name = GRP_ASM, seq = 1, type = ASM, Control Node = 0] ========================================
n_ok_ep = 2
ok_ep_arr(index, seqno):
(0, 0)
(1, 1)
sta = OPEN, sub_sta = STARTUP
break ep = NULL
recover ep = NULL
crash process over flag is TRUE
ep: css_time inst_name seqno port mode inst_status vtd_status is_ok active guid ts
2020-06-14 11:58:06 ASM0 0 9349 Control Node OPEN WORKING OK TRUE 666893121 666894598
2020-06-14 11:58:06 ASM1 1 9351 Normal Node OPEN WORKING OK TRUE 666900164 666901634
=================== group[name = GRP_DSC, seq = 2, type = DB, Control Node = 0] ========================================
n_ok_ep = 2
ok_ep_arr(index, seqno):
(0, 0)
(1, 1)
sta = OPEN, sub_sta = STARTUP
break ep = NULL
recover ep = NULL
crash process over flag is TRUE
ep: css_time inst_name seqno port mode inst_status vtd_status is_ok active guid ts
2020-06-14 11:58:06 RAC0 0 5236 Control Node OPEN WORKING OK TRUE 2443402795 2443403575
2020-06-14 11:58:06 RAC1 1 5236 Normal Node OPEN WORKING OK TRUE 2443414073 2443414837
==================================================================================================================
在监视器服务器上配置dmmonitor.ini
MON_LOG_PATH = /dm/data/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 64
MON_LOG_SPACE_LIMIT = 0
MON_DW_CONFIRM = 0
[GRP1]
MON_INST_OGUID = 43333
MON_DW_IP = 192.168.25.40:3567/192.168.25.41:3568
MON_DW_IP = 192.168.25.33:3569
启动监视器:
[dmdba@DaMengDB bin]$ ./dmmonitor /dm/monitor/dmmonitor.ini
[monitor] 2020-06-14 11:51:07: DMMONITOR[4.0] V8
[monitor] 2020-06-14 11:51:07: DMMONITOR[4.0] IS READY.
[monitor] 2020-06-14 11:51:07: 收到守护进程(RAC1)消息
WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN
2020-06-14 11:51:08 STARTUP OK RAC0 OPEN PRIMARY VALID 2 37415 38574
[monitor] 2020-06-14 11:51:07: 收到守护进程(RAC_STB)消息
WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN
2020-06-14 11:51:06 OPEN OK RAC_STB OPEN STANDBY VALID 2 38574 38574
[monitor] 2020-06-14 11:51:07: 收到守护进程(RAC0)消息
WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN
2020-06-14 11:51:08 OPEN OK RAC0 OPEN PRIMARY VALID 2 37415 38574
show
2020-06-14 11:52:39
#================================================================================#
GROUP OGUID MON_CONFIRM MODE MPP_FLAG
GRP1 43333 FALSE MANUAL FALSE
<>
IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT
192.168.25.40 3567 2020-06-14 11:52:39 GLOBAL VALID OPEN RAC0 OK 2 2 OPEN PRIMARY DSC_OPEN REALTIME VALID
EP INFO:
INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG
5236 OK RAC0 OPEN PRIMARY 0 0 REALTIME VALID 3943 37415 3943 38574 NONE
5236 OK RAC1 OPEN PRIMARY 1 0 REALTIME VALID 2465 38574 2465 38574 NONE
<>
IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT
192.168.25.33 3569 2020-06-14 11:52:37 GLOBAL VALID OPEN RAC_STB OK 1 1 OPEN STANDBY DSC_OPEN REALTIME VALID
EP INFO:
INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG
5236 OK RAC_STB OPEN STANDBY 0 0 REALTIME VALID 3939 38574 3939 38574 NONE
DATABASE(RAC_STB) APPLY INFO FROM (RAC0):
DSC_SEQNO[0], (ASEQ, SSEQ, KSEQ)[3943, 3943, 3943], (ALSN, SLSN, KLSN)[37415, 37415, 37415], N_TSK[0], TSK_MEM_USE[0]
DSC_SEQNO[1], (ASEQ, SSEQ, KSEQ)[2465, 2465, 2465], (ALSN, SLSN, KLSN)[38574, 38574, 38574], N_TSK[0], TSK_MEM_USE[0]
#================================================================================#
主库两节点注册dmcss服务:
1、修改dmdcr.ini配置文件,内容如下:
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/dm/data/dmdsc/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 0
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL = 60
DMDCR_ASM_STARTUP_CMD = /dm/dmdbms/bin/dmasmsvr dcr_ini=/dm/data/dmdsc/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 60
DMDCR_DB_STARTUP_CMD = /dm/dmdbms/bin/dmserver path=/dm/data/dsc0_config/dm.ini dcr_ini=/dm/data/dmdsc/dmdcr.ini mount
#mount可加可不加,因为主备配置好了之后,正常启动主库实例,不启动dmwatcher,数据库实例只能启动到mount状态
#另外,可以单独配置ASM和DB服务启动,不通过dmcss拉起ASM和DB
2、使用dm_service_installer.sh 脚本注册DMCSS系统服务(root用户)
节点1:
[root@localhost ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm/data/dmdsc/dmdcr.ini -p RAC0
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServiceRAC0.service to /usr/lib/systemd/system/DmCSSServiceRAC0.service.
创建服务(DmCSSServiceRAC0)完成
节点2:
[root@localhost ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm/data/dmdsc/dmdcr.ini -p RAC1
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServiceRAC1.service to /usr/lib/systemd/system/DmCSSServiceRAC1.service.
创建服务(DmCSSServiceRAC1)完成
3、注册dmwatcher服务
主库节点1:
[root@localhost ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -watcher_ini /dm/data/dsc0_config/dmwatcher.ini -p RAC0
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServiceRAC0.service to /usr/lib/systemd/system/DmWatcherServiceRAC0.service.
创建服务(DmWatcherServiceRAC0)完成
主库节点2:
[root@localhost ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -watcher_ini /dm/data/dsc1_config/dmwatcher.ini -p RAC1
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServiceRAC1.service to /usr/lib/systemd/system/DmWatcherServiceRAC1.service.
创建服务(DmWatcherServiceRAC1)完成
备库:
[root@localhost ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -watcher_ini /dm/data/RAC_STB/DAMENG/dmwatcher.ini -p RAC_STB
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServiceRAC_STB.service to /usr/lib/systemd/system/DmWatcherServiceRAC_STB.service.
创建服务(DmWatcherServiceRAC_STB)完成
4、DMDSC主库注册dmserver服务
需要注意的是在systemd服务环境下配置dmserver和dmasmsvr服务,需要设置设置依赖服务。
dmserver服务依赖dmasmsvr服务;dmasmsvr服务依赖dmcss服务;
所以在配置dmserver服务前需要配置dmasmsvr服务。
这里只列节点1,节点2类似:
---首先配置dmasmsvr服务(前面已经配置了dmcss服务)
[root@localhost ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /dm/data/dmdsc/dmdcr.ini -p RAC0 -y DmCSSServiceRAC0
Created symlink from /etc/systemd/system/multi-user.target.wants/DmASMSvrServiceRAC0.service to /usr/lib/systemd/system/DmASMSvrServiceRAC0.service.
创建服务(DmASMSvrServiceRAC0)完成
---再配置dmserver服务
[root@localhost ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /dm/data/dsc0_config/dm.ini -dcr_ini /dm/data/dmdsc/dmdcr.ini -p RAC0 -y DmASMSvrServiceRAC0
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceRAC0.service to /usr/lib/systemd/system/DmServiceRAC0.service.
创建服务(DmServiceRAC0)完成
主库创建测试表:
[dmdba@localhost bin]$ ./disql sysdba/SYSDBA@rac
服务器[192.168.15.40:5236]:处于主库打开状态
登录使用时间: 7.319(毫秒)
disql V8
SQL> create table test as select 11;
操作已执行
已用时间: 167.394(毫秒). 执行号:5.
SQL> select * from test;
行号 11
---------- -----------
1 11
已用时间: 5.323(毫秒). 执行号:6.
备库查询:
[dmdba@localhost bin]$ ./disql
disql V8
用户名:
密码:
服务器[LOCALHOST:5236]:处于备库打开状态
登录使用时间: 4.727(毫秒)
SQL>
SQL> select * from test;
行号 11
---------- -----------
1 11
已用时间: 6.014(毫秒). 执行号:5.
至此,主备搭建完成。