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.

发表评论

电子邮件地址不会被公开。