【达梦数据库】两地三中心环境总结
架构
2(1主1实时备库)+1(实时备库)+1(异步备库),分别为节点1、2、3、4
监视器位置
生产环境放在异地的异步备库上
异步备库同步频率配置:dmtimer.ini
TYPE= 10
FREQ_MONTH_WEEK_INTERVAL=
FREQ_SUB_INTERVAL=
FREQ_MINUTE_INTERVAL=
REPEAT_INTERVAL= FREQ=SECONDLY;INTERVAL=1
START_TIME = 00:00:00
END_TIME = 00:00:00
DURING_START_DATE= 2023-10-23 19:30:00
DURING_END_DATE= 9999-12-31 23:59:59
NO_END_DATE_FLAG= 1
DESCRIBE= RT TIMER
IS_VALID= 1
断网测试
主备自动切换模式心跳网断开测试:
1、DW1为主时,关闭DW1的心跳网,DW1自动shutdown,监视器执行切换流程,备库DW2接管为主库。恢复DW1与心跳网后,DW1以备库模式加入集群。
2、继续上个步骤后的测试,DW2为主时,关闭DW2心跳网,DW2 suppend挂起,监视器执行切换流程,备库DW1接管为主库,恢复心跳网后,DW2自动shutdown,再次开启DW2 自动以备库模式加入集群。
异地切换过程&回切:允许丢数据模式
切换
1、kill -9 本地(节点1、节点2)+同城(节点3)数据库实例
2、将异地备库切换为主库对外提供服务,
2.1、关闭数据守护服务:/data/dmdata/dmwatcher4_0/bin/DmWatcherServiceEP04.sh stop
2.2、更改数据库状态为MOUNT:
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
ALTER DATABASE MOUNT;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
2.3、更改数据库模式为PRIMARY::
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
ALTER DATABASE PRIMARY;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
2.4、开启数据守护服务:/data/dmdata/dmwatcher4_0/bin/DmWatcherServiceEP04.sh start
回切
1、停止数据库、物理备份、物理还原
1.1、停止数据库
数据守护服务:/data/dmdata/dmwatcher4_0/bin/DmWatcherServiceEP04.sh stop
数据库服务:/data/dmdata/dmwatcher4_0/bin/DmServiceEP04.sh stop
1.2、物理备份
dmrman use_ap=2
backup database '/data/dmdata/dmwatcher4_0/EP04/DAMENG/dm.ini' backupset '/data/dmdata/bakfull';
1.3、物理还原
节点1:
dmrman
restore database '/data/dmdata/dmwatcher4_0/EP01/DAMENG/dm.ini' from backupset '/data/dmdata/bakfull';
recover database '/data/dmdata/dmwatcher4_0/EP01/DAMENG/dm.ini' from backupset '/data/dmdata/bakfull';
recover database '/data/dmdata/dmwatcher4_0/EP01/DAMENG/dm.ini' update db_magic;
节点2:
dmrman
restore database '/data/dmdata/dmwatcher4_0/EP02/DAMENG/dm.ini' from backupset '/data/dmdata/bakfull';
recover database '/data/dmdata/dmwatcher4_0/EP02/DAMENG/dm.ini' from backupset '/data/dmdata/bakfull';
recover database '/data/dmdata/dmwatcher4_0/EP02/DAMENG/dm.ini' update db_magic;
节点3:
dmrman
restore database '/data/dmdata/dmwatcher4_0/EP03/DAMENG/dm.ini' from backupset '/data/dmdata/bakfull';
recover database '/data/dmdata/dmwatcher4_0/EP03/DAMENG/dm.ini' from backupset '/data/dmdata/bakfull';
recover database '/data/dmdata/dmwatcher4_0/EP03/DAMENG/dm.ini' update db_magic;
2、启动数据库服务,更改节点模式
2.1、启动数据库服务:
节点1:
/data/dmdata/dmwatcher4_0/bin/DmServiceEP01.sh start
节点2:
/data/dmdata/dmwatcher4_0/bin/DmServiceEP02.sh start
节点3:
/data/dmdata/dmwatcher4_0/bin/DmServiceEP03.sh start
节点4:
/data/dmdata/dmwatcher4_0/bin/DmServiceEP04.sh start
2.2、更改数据库模式:
节点1:
disql SYSDBA/SYSDBA
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
ALTER DATABASE PRIMARY;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
节点2、3、4:
disql SYSDBA/SYSDBA
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
ALTER DATABASE STANDBY;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
3、启动数据守护服务:
节点1:
/data/dmdata/dmwatcher4_0/bin/DmWatcherServiceEP01.sh start
节点2:
/data/dmdata/dmwatcher4_0/bin/DmWatcherServiceEP02.sh start
节点3:
/data/dmdata/dmwatcher4_0/bin/DmWatcherServiceEP03.sh start
节点4:
/data/dmdata/dmwatcher4_0/bin/DmWatcherServiceEP04.sh start
原文地址:https://blog.csdn.net/weixin_47686079/article/details/145229498
免责声明:本站文章内容转载自网络资源,如侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!