主备MPP需要两套主备集群,在集群的基础上做的MPP
1、准备工作
创建数据库,并重启
主机102
dminit extent_size=32 page_size=32 CASE_SENSITIVE=1 CHARSET=1 INSTANCE_NAME=MPP_102 DB_NAME=MPP_102 PORT_NUM=5237 path=/data/dm
dminit extent_size=32 page_size=32 CASE_SENSITIVE=1 CHARSET=1 INSTANCE_NAME=MPP_103_STA DB_NAME=MPP_103_STA PORT_NUM=5217 path=/data/dm
主机103
dminit extent_size=32 page_size=32 CASE_SENSITIVE=1 CHARSET=1 INSTANCE_NAME=MPP_103 DB_NAME=MPP_103 PORT_NUM=5217 path=/data/dm
dminit extent_size=32 page_size=32 CASE_SENSITIVE=1 CHARSET=1 INSTANCE_NAME=MPP_102_STA DB_NAME=MPP_102_STA PORT_NUM=5237 path=/data/dm
主备库数据一致:
[dmdba@node3 ~]$ dmrman CTLSTMT="BACKUP DATABASE '/data/dm/MPP_103/dm.ini' FULL TO BACKUP_FILE1 BACKUPSET '/data/dm/bak/103'"
[dmdba@node3 ~]$scp /data/dm/bak/103/* v2:/data/dm/bak/103
[dmdba@node2 ~]$ dmrman CTLSTMT="RESTORE DATABASE '/data/dm/MPP_103_STA/dm.ini' FROM BACKUPSET '/data/dm/bak/103'"
[dmdba@node2 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/data/dm/MPP_103_STA/dm.ini' FROM BACKUPSET '/data/dm/bak/103'"
[dmdba@node2 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/data/dm/MPP_103_STA/dm.ini' UPDATE DB_MAGIC"
2、修改参数文件
主库102
[dmdba@node2 ~]$ vim /data/dm/MPP_102/dm.ini |grep
'INSTANCE_NAME\|PORT_NUM\|MAL_INI\|MPP_INI\|ARCH_INI'
INSTANCE_NAME = MPP_102 #Instance name
PORT_NUM = 5237 #Port number on which the database server will listen
MAL_INI = 1 #dmmal.ini
ARCH_INI = 1 #dmarch.ini
MPP_INI = 1 #dmmpp.ini
备库102
[dmdba@node3 bak]$ vim /data/dm/MPP_102_STA/dm.ini |grep
'INSTANCE_NAME\|PORT_NUM\|MAL_INI\|MPP_INI\|ARCH_INI'
INSTANCE_NAME = MPP_102_STA #Instance name
PORT_NUM = 5237 #Port number on which the database server will listen
MAL_INI = 1 #dmmal.ini
ARCH_INI = 1 #dmarch.ini
MPP_INI = 1 #dmmpp.ini
主库103
[dmdba@node3 bak]$ vim /data/dm/MPP_103/dm.ini |grep
'INSTANCE_NAME\|PORT_NUM\|MAL_INI\|MPP_INI\|ARCH_INI'
INSTANCE_NAME = MPP_103 #Instance name
PORT_NUM = 5217 #Port number on which the database server will listen
MAL_INI = 1 #dmmal.ini
ARCH_INI = 1 #dmarch.ini
MPP_INI = 1 #dmmpp.ini
备库103
[dmdba@node2 ~]$ vim /data/dm/MPP_103_STA/dm.ini |grep
'INSTANCE_NAME\|PORT_NUM\|MAL_INI\|MPP_INI\|ARCH_INI'
INSTANCE_NAME = MPP_103_STA #Instance name
PORT_NUM = 5217 #Port number on which the database server will listen
MAL_INI = 1 #dmmal.ini
ARCH_INI = 1 #dmarch.ini
MPP_INI = 1 #dmmpp.ini
3、修改归档日志
主机102
[dmdba@node2 ~]$ vim /data/dm/MPP_102/dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME #实时归档类型
ARCH_DEST =MPP_102_STA #实时归档目标实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /data/dm/MPP_102/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 1024
[dmdba@node2 ~]$ vim /data/dm/MPP_103_STA/dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME #实时归档类型
ARCH_DEST =MPP_103 #实时归档目标实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /data/dm/MPP_103_STA/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 1024
主机103
[dmdba@node3 bak]$ vim /data/dm/MPP_103/dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME #实时归档类型
ARCH_DEST =MPP_103_STA #实时归档目标实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /data/dm/MPP_103/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 1024
[dmdba@node3 bak]$ vim /data/dm/MPP_102_STA/dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME #实时归档类型
ARCH_DEST =MPP_102 #实时归档目标实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /data/dm/MPP_102_STA/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 1024
4、修改dmmal.ini
dmmal.ini主备库一致
[dmdba@node2 ~]$ vim /data/dm/MPP_103_STA/dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = MPP_102
MAL_HOST = 10.12.11.102
MAL_PORT = 5235
MAL_INST_HOST = 192.168.1.102
MAL_INST_PORT = 5237
MAL_DW_PORT = 5233
MAL_INST_DW_PORT = 5234
[MAL_INST2]
MAL_INST_NAME = MPP_102_STA
MAL_HOST = 10.12.11.103
MAL_PORT = 5235
MAL_INST_HOST = 192.168.1.103
MAL_INST_PORT = 5237
MAL_DW_PORT = 5233
MAL_INST_DW_PORT = 5234
[MAL_INST3]
MAL_INST_NAME = MPP_103
MAL_HOST = 10.12.11.103
MAL_PORT = 5215
MAL_INST_HOST = 192.168.1.103
MAL_INST_PORT = 5217
MAL_DW_PORT = 5213
MAL_INST_DW_PORT = 5214
[MAL_INST4]
MAL_INST_NAME = MPP_103_STA
MAL_HOST = 10.12.11.102
MAL_PORT = 5215
MAL_INST_HOST = 192.168.1.102
MAL_INST_PORT = 5217
MAL_DW_PORT = 5213
MAL_INST_DW_PORT = 5214
5、守护进程watcher
主机102
[dmdba@node2 ~]$ vim /data/dm/MPP_102/dmwatcher.ini
[MPP_102]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 45330
INST_INI = /data/dm/MPP_102/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /data/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
[MPP_103]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 45331
INST_INI = /data/dm/MPP_103_STA/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /data/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
主机103
[dmdba@node3 bak]$ vim /data/dm/MPP_103/dmwatcher.ini
[MPP_103]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 45331
INST_INI = /data/dm/MPP_103/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /data/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
[MPP_102]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 45330
INST_INI = /data/dm/MPP_102_STA/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /data/dmdbms/bin/dmserver
6、监视器
监视器配置在第三台主机上,配置在主机103上
[dmdba@node3 bak]$ vim /data/dm/MPP_103/dmmonitor.ini
MON_DW_CONFIRM = 0 =====MON_DW_CONFIRM:0是普通监视器,1是确认监视器
MON_LOG_PATH = /data/dmdbms/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[MPP_102] ====与守护进程dmwatcher.ini一致
MON_INST_OGUID = 45330
MON_DW_IP = 10.12.11.102:5233
MON_DW_IP = 10.12.11.103:5233
[MPP_103] ====与守护进程dmwatcher.ini一致
MON_INST_OGUID = 45331
MON_DW_IP = 10.12.11.102:5213
MON_DW_IP = 10.12.11.103:5213
7、mpp.ini配置
[dmdba@node3 bak]$ vim /data/dm/MPP_103/dmmpp.ini
[service_name1]
mpp_seq_no = 0
mpp_inst_name = MPP_102
[service_name2]
mpp_seq_no = 1
mpp_inst_name = MPP_103
编辑dmmpp.ini文件生成dmmpp.ctl ?
[dmdba@node3 bak]$ dmctlcvt ?TYPE=2 ?SRC=/data/dm/MPP_103/dmmpp.ini DEST=/data/dm/MPP_103/dmmpp.ctl
复制到各主备数据库目录下
8、启动数据库
启动数据库到mount状态,启动顺序与主备集群一致
主备102
[dmdba@node2 ~]$ dmserver /data/dm/MPP_102/dm.ini mount
[dmdba@node3 ~]$ dmserver /data/dm/MPP_102_STA/dm.ini mount
主备103
[dmdba@node3 ~]$ dmserver /data/dm/MPP_103/dm.ini mount
[dmdba@node2 ~]$ dmserver /data/dm/MPP_103_STA/dm.ini mount
9、修改数据库角色和oguid
主备库先disql登录后在修改
102主库
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL> sp_set_oguid(45330);
SQL> alter database primary;
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
102备库
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL> sp_set_oguid(45330);
SQL> alter database standby;
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
103主库
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL> sp_set_oguid(45331);
SQL> alter database primary;
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
103备库
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL> sp_set_oguid(45331);
SQL> alter database standby;
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
dmdba@node2 dm]$ disql SYSDBA/SYSDBA@192.168.1.102:5217
[dmdba@node2 dm]$ disql SYSDBA/SYSDBA*local@192.168.1.102:5237
10、启动守护进程和监视器
启动守护
[dmdba@node2 ~]$ dmwatcher /data/dm/MPP_102/dmwatcher.ini
[dmdba@node3 ~]$ dmwatcher /data/dm/MPP_103/dmwatcher.ini
启动监视器
[dmdba@node3 ~]$ dmmonitor /data/dm/MPP_103/dmmonitor.ini
11、注册服务
主机102
[root@node2 ~]# /data/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /data/dm/MPP_102/dm.ini -p MPP_102
[root@node2 ~]# /data/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /data/dm/MPP_103_STA/dm.ini -p MPP_103_STA
[root@node2 ~]# /data/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -watcher_ini /data/dm/MPP_102/dmwatcher.ini -p MPP_102
主机103
[root@node3 ~]# /data/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /data/dm/MPP_103/dm.ini -p MPP_103
[root@node3 ~]# /data/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /data/dm/MPP_102_STA/dm.ini -p MPP_102_STA
[root@node3 ~]# /data/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -watcher_ini /data/dm/MPP_103/dmwatcher.ini -p MPP_103
[root@node3 ~]# /data/dmdbms/script/root/dm_service_installer.sh -t dmmonitor -monitor_ini /data/dm/MPP_103/dmmonitor.ini -p MPP_103
更多资讯请上达梦技术社区了解: https://eco.dameng.com
|