达梦数据库数据守护集群搭建

2022-03-30 00:00:00 实例 监听 归档 单位 守护

A服务器配置
IP:192.168.85.128

初始化实例
[dmdba@~]# /opt/dmdbms/bin/dminit PATH=/opt/dmdbms/data/ INSTANCE_NAME=RWC1_01 PAGE_SIZE=32 LOG_SIZE=2048


注册服务
[root@~]# /opt/dmdbms/script/root/dm_service_installer.sh -t dmserver -p RWC1_01 -dm_ini /opt/dmdbms/data/DAMENG/dm.ini -m mount
启动服务
[dmdba@~]# /opt/dmdbms/bin/DmServiceRWC1_01 start
设置归档
[dmdba@~]# /opt/dmdbms/bin/disql SYSDBA/SYSDBA@192.168.85.128:5236
SQL> ALTER DATABASE MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE ADD ARCHIVELOG 'DEST=/opt/dmdbms/data/DAMENG/arch, TYPE=LOCAL, FILE_SIZE=1024, SPACE_LIMIT=51200';
SQL> ALTER DATABASE OPEN;


备份数据
SQL> BACKUP DATABASE BACKUPSET '/opt/dmdbms/data/DAMENG/bak/BACKUP_FILE';
--修改dm.ini
SQL> SP_SET_PARA_VALUE (2,'PORT_NUM',5236);
SQL> SP_SET_PARA_VALUE (2,'DW_INACTIVE_INTERVAL',60);
SQL> SP_SET_PARA_VALUE (2,'ALTER_MODE_STATUS',0);
SQL> SP_SET_PARA_VALUE (2,'ENABLE_OFFLINE_TS',2);
SQL> SP_SET_PARA_VALUE (2,'MAL_INI',1);
SQL> SP_SET_PARA_VALUE (2,'RLOG_SEND_APPLY_MON',64);


编辑dmarch.ini
[dmdba@~]# vi /opt/dmdbms/data/DAMENG/dmarch.ini
ARCH_WAIT_APPLY = 1
[ARCHIVE_LOCAL]
ARCH_TYPE = LOCAL #本地归档类型
ARCH_DEST = /opt/dmdbms/data/DAMENG/arch/ #本地归档存放路径
ARCH_FILE_SIZE = 1024 #单个归档大小,单位MB
ARCH_SPACE_LIMIT = 51200 #归档上限,单位MB
[ARCHIVE_TIMELY1]
ARCH_TYPE = REALTIME #实时归档类型
ARCH_DEST = RWC1_01B #实时归档目标实例名


创建dmmal.ini
[dmdba@~]# vi /opt/dmdbms/data/DAMENG/dmmal.ini
MAL_CHECK_INTERVAL = 30 #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 30 #判定MAL链路断开的时间
MAL_TEMP_PATH = /opt/dmdbms/data/malpath/ #临时文件目录
MAL_BUF_SIZE = 512 #单个MAL缓存大小,单位MB
MAL_SYS_BUF_SIZE = 2048 #MAL总大小限制,单位MB
MAL_COMPRESS_LEVEL = 0 #MAL消息压缩等级,0表示不压缩

[MAL_INST1]
MAL_INST_NAME = RWC1_01 #实例名,和 dm.ini的INSTANCE_NAME一致
MAL_HOST = 192.168.85.128 #MAL系统监听TCP连接的IP地址
MAL_PORT = 5336 #MAL系统监听TCP连接的端口
MAL_INST_HOST = 172.16.1.1 #实例的对外服务IP地址
MAL_INST_PORT = 5236 #实例对外服务端口,和dm.ini的PORT_NUM一致
MAL_DW_PORT = 5436 #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5536 #实例监听守护进程TCP连接的端口
[MAL_INST2]
MAL_INST_NAME = RWC1_01B
MAL_HOST = 192.168.85.129
MAL_PORT = 5336
MAL_INST_HOST = 172.16.1.2
MAL_INST_PORT = 5236
MAL_DW_PORT = 5436
MAL_INST_DW_PORT = 5536


创建dmwatcher.ini
[dmdba@~]# vi /opt/dmdbms/data/DAMENG/dmwatcher.ini
[GRWC1]
DW_TYPE = GLOBAL #全局守护类型
DW_MODE = MANUAL #故障手动切换模式
DW_ERROR_TIME = 20 #远程守护进程故障认定时间
INST_ERROR_TIME = 20 #本地实例故障认定时间
INST_RECOVER_TIME = 60 #主库守护进程启动恢复的间隔时间
INST_OGUID = 45331 #守护系统OGUID值
INST_INI = /opt/dmdbms/data/DAMENG/dm.ini #dm.ini文件路径
INST_AUTO_RESTART = 1 #打开实例的自动启动功能
INST_STARTUP_CMD = /opt/dmdbms/bin/dmserver #命令行方式启动
RLOG_SEND_THRESHOLD = 0 #指定主库发送日志到备库的时间阈值,默认关闭
RLOG_APPLY_THRESHOLD = 0 #指定备库重演日志的时间阈值,默认关闭


拷贝实例到B服务器
[dmdba@~]# scp -r /opt/dmdbms/data/DAMENG dmdba@192.168.85.129:/opt/dmdbms/data/


注册实例服务
[root@~]# /opt/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -p Watcher -watcher_ini /opt/dmdbms/data/DAMENG/dmwatcher.ini


B服务器配置
IP:192.168.85.129

修改dm.ini
[dmdba@~]# vi /opt/dmdbms/data/DAMENG/dm.ini
INSTANCE_NAME = RWC1_01B #数据库实例名


修改dmarch.ini
[dmdba@~]# vi /opt/dmdbms/data/DAMENG/dmarch.ini
ARCH_WAIT_APPLY = 1
[ARCHIVE_LOCAL]
ARCH_TYPE = LOCAL #本地归档类型
ARCH_DEST = /opt/dmdbms/data/DAMENG/arch/ #本地归档存放路径
ARCH_FILE_SIZE = 1024 #单个归档大小,单位MB
ARCH_SPACE_LIMIT = 51200 #归档上限,单位MB
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME #实时归档类型
ARCH_DEST = RWC1_01 #实时归档目标实例名


注册实例服务
[root@~]# /opt/dmdbms/script/root/dm_service_installer.sh -t dmserver -p RWC1_01B -dm_ini /opt/dmdbms/data/DAMENG/dm.ini -m mount
[root@~]# /opt/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -p Watcher -watcher_ini /opt/dmdbms/data/DAMENG/dmwatcher.ini


还原数据
[dmdba@~]# /opt/dmdbms/bin/dmrman CTLSTMT="RESTORE DATABASE '/opt/dmdbms/data/DAMENG/dm.ini' FROM BACKUPSET '/opt/dmdbms/data/DAMENG/bak/BACKUP_FILE'"
[dmdba@~]# /opt/dmdbms/bin/dmrman CTLSTMT="RECOVER DATABASE '/opt/dmdbms/data/DAMENG/dm.ini' FROM BACKUPSET '/opt/dmdbms/data/DAMENG/bak/BACKUP_FILE'"
[dmdba@~]# /opt/dmdbms/bin/dmrman CTLSTMT="RECOVER DATABASE '/opt/dmdbms/data/DAMENG/dm.ini' UPDATE DB_MAGIC"






配置监视器
创建dmmonitor.ini
[dmdba@~]# vi /opt/dmdbms/bin/dmmonitor.ini
MON_DW_CONFIRM = 0 #0为非确认,1为确认
MON_LOG_PATH = ../log #监视器日志文件存放路径
MON_LOG_INTERVAL = 60 #每隔 60s 定时记录系统信息到日志文件
MON_LOG_FILE_SIZE = 512 #单个日志大小,单位MB
MON_LOG_SPACE_LIMIT = 2048 #日志上限,单位MB

[GRWC1]
MON_INST_OGUID = 45331 #组GRWC1的OGUID 值
MON_DW_IP = 192.168.85.128:5436 #IP对应MAL_HOST,PORT对应MAL_DW_PORT
MON_DW_IP = 192.168.85.129:5436


A服务器
修改参数
[dmdba@~]# /opt/dmdbms/bin/disql SYSDBA/SYSDBA@192.168.85.128:5236
SQL> SP_SET_OGUID(45331);
SQL> ALTER DATABASE PRIMARY;


B服务器
启动服务并修改参数
[dmdba@~]# /opt/dmdbms/bin/DmServiceRWC1_01B start
[dmdba@~]# /opt/dmdbms/bin/disql SYSDBA/SYSDBA@192.168.85.129:5236
SQL> SP_SET_OGUID(45331);
SQL> ALTER DATABASE STANDBY;


A、B服务器
启动守护进程
[dmdba@~]# /opt/dmdbms/bin/DmWatcherServiceWatcher start


启动监视器
[dmdba@~]# /opt/dmdbms/bin/dmmonitor /opt/dmdbms/bin/dmmonitor.ini


使用login命令进行登录

————————————————
版权声明:本文为CSDN博主「Lean_Miller」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_48005723/article/details/123306941

相关文章