注册
达梦数据库数据守护集群搭建操作流程
专栏/培训园地/ 文章详情 /

达梦数据库数据守护集群搭建操作流程

WESTEROSKY 2024/06/21 497 0 0
摘要

记录数据守护集群搭建流程:
主机:
ip : 192.168.165.188
数据库名:DM01
实例名:DMSVR01
PORT_NUM :5236
MAL_INST_DW_PORT:45101
MAL_PORT: 55101 MAL_DW_PORT:65101
备机:
ip:192.168.165.204
数据库名:DM01
实例名:DMSVR02
PORT_NUM :5236
MAL_INST_DW_PORT:45101
MAL_PORT: 55121
MAL_DW_PORT:65121
监视器:
ip:192.168.165.161
OGUID :数据守护唯一标识码,用来标识、校验,相同 OGUID 值的实例。在下述操作中,我们给它定义为 8888
此外,主库需要先做归档;
具体操作步骤:
1、关闭主库服务,冷备,并将备份拷贝到备机上
[dmdba@localhost bin]$./DmServiceDMSVR01 stop
[dmdba@localhost bin]$ ./dmrman
RMAN>backup database '/dm8/data/DM01/dm.ini' backupset '/dm8/backup';

[dmdba@localhost backup]$ scp back* dmdba@192.168.165.204:/dm8/backup

2、配置主库的 dm.ini,dmmal.ini,dmarch.ini,dmwatcher.ini 文件
修改 dm.ini 参数文件如下:
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1

配置 dmmal.ini 文件
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.165.188
MAL_PORT = 55101
MAL_INST_HOST = 192.168.165.188
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME =DMSVR02
MAL_HOST = 192.168.165.204
MAL_PORT = 55121
MAL_INST_HOST = 192.168.165.204
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121

配置归档日志文件:
[dmdba@localhost DAMENG]$ cat dmarch.ini
ARCH_WAIT_APPLY = 0
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR02
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 0
ARCH_FLUSH_BUF_SIZE = 0
ARCH_HANG_FLAG = 1

配置 dmwatcher.ini 文件
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 8888
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

3、将主库启动到 mount 状态
[dmdba@localhost bin]$ ./dmserver /dm8/data/DM01/dm.ini mount

4、修改主库的配置
[dmdba@localhost bin]$ ./disql sysdba/DM01SYSDBA@192.168.165.188:5236
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL>sp_set_oguid(8888);
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
SQL>alter database primary;

5、备机上初始化数据库,并恢复数据库
用命令行初始化数据库实例
(后面用disql书写sql语句时或启动备库守护进程时,可能会提示DMSVR02不存在之类的,需要注册下数据库实例DMSVR02:可以启动dbca.sh用图形化界面注册实例服务)
[dmdba@localhost bin]$ ./dminit db_name=DM01 instance_name=DMSVR02 port_num=5236 path=/dm8/data
[dmdba@localhost bin]$ ./dmrman
RMAN> restore database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
RMAN> recover database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
RMAN> recover database '/dm8/data/DM01/dm.ini' update db_magic;

6、配置备库文件: dm.ini,dmmal.ini,dmarch.ini,dmwatcher.ini
修改 dm.ini 参数文件如下:
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1

将主机中的配置文件上传到备机上(考试时/opt/temple有模板,自己练习时,可以输几遍加深印象,比对实例名和端口的区别)
scp dmarch.ini dmwatcher.ini dmarch.ini dmdba@192.168.165.204:/dm8/data/DM01

配置归档文件 dmarch.ini
ARCH_WAIT_APPLY = 0
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR01
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 0
ARCH_FLUSH_BUF_SIZE = 0
ARCH_HANG_FLAG = 1

配置 dmmal.ini 文件
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.165.188
MAL_PORT = 55101
MAL_INST_HOST = 192.168.165.188
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME =DMSVR02
MAL_HOST = 192.168.165.204
MAL_PORT = 55121
MAL_INST_HOST = 192.168.165.204
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
配置 dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 8888
INST_INI = /dm8/data/DAMENG/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

7、启动备库到 mount 状态
[dmdba@localhost bin]$ ./dmserver /dm8/data/DA01/dm.ini mount
(修改无效果可用这种方式:
SQL>select status$ from v$instance
SQL>alter database mount;
)

8、修改备库的配置
[dmdba@localhost bin]$ ./disql sysdba/DM01SYSDBA@192.168.165.204:5236
SQL> sp_set_oguid(8888);
SQL> alter database standby;

9、分别启动主库和备库上的守护进程
[dmdba@localhost bin]$ ./dmwatcher /dm8/data/DM01/dmwatcher.ini

10、配置监视器
配置 dmmonitor.ini 文件
[GRP1]
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 = 8888
MON_DW_IP = 192.168.224.134:65101
MON_DW_IP = 192.168.165.204:65121

[dmdba@localhost bin]$ ./dmmonitor /dm8/data/dmmontor.ini

登录监视器: login
查看数据守护集群的信息: Show
主备切换: Switchover

11.注册数据守护集群服务:
主库:
[root@localhost ~]# cd /dm8/script/root/
[root@localhost root]# ./dm_service_installer.sh -t dmwatcher -p DMSVR01 -watcher_ini /dm8/data/DM01/dmwatcher.ini
备库:
[root@localhost ~]# cd /dm8/script/root/
[root@localhost root]# ./dm_service_installer.sh -t dmwatcher -watcher_ini /dm8/data/DM01/dmwatcher.ini -p DMSVR02
监视器:
[root@localhost ~]# cd /dm8/script/root/
[root@localhost root]# ./dm_service_installer.sh -t dmmonitor -monitor_ini /dm8/data/dmmonitor.ini -p monitor

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服