注册
达梦主备守护集群搭建
专栏/培训园地/ 文章详情 /

达梦主备守护集群搭建

gh 2024/03/13 721 0 0
摘要

数据守护集群的实际搭建是一项重要的实践技能,DCP考试中必考题目,考试中由于时间紧任务重此项任务没有操作完全。现在分享具体配置过程,具体如下。

一、环境准备
主机:192.168.165.112
备机:192.168.165.146
监视器:192.168.165.160

重要参数配置如下:

二、数据库准备
创建主备机实例DMSVR01,DMSVR02,并进行初始化实例。
为了保持主备库一致,需要将主库进行脱机备份,将备份文件发送到备库,备库进行脱机还原。

以下为主机操作步骤:
1.使用dmdba用户创建备份文件夹
mkdir /dm8/backup
2.关闭实例进行全量备份
cd /dm8/bin
./DmserversiceDMSERVER01 stop
./dmrman
backup database '/dm8/data/GRP1_RT_01/dm.ini' full to backup_file1 backupset '/dm8/backup/BACK_FILE_01';
备份完成后退出
3.传输备份文件至备机对应的路径下/dm8/backup
以下为备机操作步骤:
确保实例关闭
恢复操作
cd /dm8/bin
./dmrman
restore database 'dm8/data/GRP1_RT_03/dm.ini' from backupset 'dm8/backup'; recover databse 'dm8/data/GRP1_RT_03/dm.ini' from backupset 'dm8/backup'; recover database 'dm8/data/GRP1_RT_03/dm.ini' update db_magic;
至此备库数据库恢复成功,主备机数据一致。

三、配置主库配置文件
1.配置dm.ini,修改如下参数
INSTANCE_NAME = DMSVR01
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
2.配置dmmal.ini,修改如下参数
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.165.112
MAL_PORT = 55101
MAL_INST_HOST = 192.168.165.112
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.165.146
MAL_PORT = 55121
MAL_INST_HOST = 192.168.165.146
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
3.配置dmarch.ini,修改如下参数
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR02
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
4.配置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 = /dm8/data/DM01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

5.以mount状态启动,使用disql连接数据库,设置oguid并将数据库模式切换为主库
cd /dm8/bin
./dmserver /dm8/data/DM01/dm.ini mount
./disql sysdba/DM01SYSDBA@localhost:5236
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL>sp_set_oguid(453331);
SQL>alter database primary;
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
执行完成后退出

四、配置备库配置文件
1.配置dm.ini,修改如下参数
INSTANCE_NAME = DMSVR00
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
2.配置dmmal.ini,修改如下参数
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.165.112
MAL_PORT = 55101
MAL_INST_HOST = 192.168.165.112
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.165.146
MAL_PORT = 55121
MAL_INST_HOST = 192.168.165.146
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
3.配置dmarch.ini,修改如下参数
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR01
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
4.配置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 = /dm8/data/DM01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
5.以mount状态启动,使用disql连接数据库,设置oguid并将数据库模式切换为主库
cd /dm8/bin
./dmserver /dm8/data/DM01/dm.ini mount
./disql sysdba/DM01SYSDBA@localhost:5236
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL>sp_set_oguid(453331);
SQL>alter database primary;
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
执行完成后退出

五、监视器配置dmmonitor.ini,修改如下参数
MON_DW_CONFIRM = 1
MON_LOG_PATH = /dm8/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[GRP1]
MON_INST_OGUID = 453331
MON_DW_IP = 192.168.165.112:65101
MON_DW_IP = 192.168.165.146:65121

六、启动主备机守护进程,以及监视器
主机(dmdba用户):
./dmwatcher /dm8/data/DM01/dmwatcher.ini
备机(dmdba用户):

./dmwatcher /dm8/data/DM01/dmwatcher.ini

监视器:
./dmmonitor /dm8/data/DM01/dmmonitor.ini
七、主备机以及监视器服务器注册服务:
1.主备机注册服务
cd /dm8/script/root
./dm_service_installer.sh -t dmserver -p DMSERVER -m mount -dm_ini /dm8/data/DM01/dm.ini
./dm_service_installer.sh -t dmwatcher -p DMWATCHER -watcher_ini /dm8/data/DM01/dmwatcher.ini
2.监视器注册服务
./dm_service_installer.sh -t dmmonitor -p DMMONITOR -monitor_ini /dm8/data/DM01/dmmonitor.ini

至此数据守护集群搭建完成。

注意事项是开关顺序:
关闭流程:
监视器==>主库守护进程==>备库守护进程==>主库数据库服务==>备库数据库服务
开启流程:
主库数据库服务==>备库数据库服务==>主库守护进程==>备库守护进程==>监视器

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服