集群环境参考上篇
达梦数据守护集群部署
https://blog.csdn.net/qq_25045631/article/details/139900164
集群发散脑裂时,监视器显示如下,实例GRP1_RT_01发生脑裂
1. 关闭DW环境
因为Global守护类型的守护进程,会自动将数据库实例切换到Open状态,并将守护进程状态也切换为Open。因此在关闭DW系统时,请严格按照以下顺序:
1)如果启动了确认监视器,先关闭确认监视器(防止自动接管)
2)关闭主库守护进程(防止重启实例)
3)关闭备库守护进程(防止重启实例)
4)在关闭守护进程时会自动关闭对应的DM实例。但最好确认下ps -ef |grep dmserver,经常出现关不掉的情况
[root@node2 ~]# systemctl stop DmMonitorServiceDM
[root@node2 ~]# systemctl stop DmWatcherServiceDM
[root@node1 ~]# systemctl stop DmWatcherServiceDM
2. 删除分裂库dmwatcher.ctl
守护进程在检测到本地库(GRP1_RT_01)分裂时,自动创建dmwatcher.ctl文件,保存在本地库的 /opt/dmdbms/data/DAMENG/路径下,并且文件中记录的状态一定是 Split 分裂状态。
如果dmwatcher加载到dmwatcher.ctl文件,则认为对应的库一定是分裂状态。如果需要对分裂库进行重建,则需要手动将dmwatcher.ctl文件删除,否则守护进程仍然会认定本地库为分裂库。
脑裂节点dmwatcher.ctl文件显示如下
[dmdba@node1 ~]$ strings /opt/dmdbms/data/DAMENG/dmwatcher.ctl
DMWATCHER8001
[!!! Local(GRP1_RT_01, PRIMARY & MOUNT & OK)'s sysopenhistory is included in remote(GRP1_RT_02, PRIMARY & OPEN & OK), but local apply info is larger or corssed with remote apply info in sysopenhistory, set local to split status.!!!]
删除dmwatcher.ctl文件
[dmdba@node1 ~]$ rm -f /opt/dmdbms/data/DAMENG/dmwatcher.ctl
3. 备份GRP1_RT_02
[dmdba@node2 ~]$ dmrman
RMAN> backup database '/opt/dmdbms/data/DAMENG/dm.ini' full backupset '/opt/dmdbms/data/DAMENG/bak/db_full_bak_split';
[dmdba@node2 ~]$ scp -r /opt/dmdbms/data/DAMENG/bak/db_full_bak_split dmdba@192.168.25.101:/opt/dmdbms/data/DAMENG/bak/
4. 恢复GRP1_RT_01
[dmdba@node1 ~]$ dmrman CTLSTMT="RESTORE DATABASE '/opt/dmdbms/data/DAMENG/dm.ini' FROM BACKUPSET '/opt/dmdbms/data/DAMENG/bak/db_full_bak_split'"
[dmdba@node1 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/opt/dmdbms/data/DAMENG/dm.ini' FROM BACKUPSET '/opt/dmdbms/data/DAMENG/bak/db_full_bak_split'"
[dmdba@node1 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/opt/dmdbms/data/DAMENG/dm.ini' UPDATE DB_MAGIC"
以mount模式前台启动GRP1_RT_01
[dmdba@node1 ~]$ dmserver /opt/dmdbms/data/DAMENG/dm.ini mount
打开一个新的终端
[dmdba@node1 ~]$ disql SYSDBA/SYSDBA@127.0.0.1:5236
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL> alter database standby;
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
操作完成后退出前台启动
5. 启动DW环境
启动备库守护进程
启动主库守护进程
启动确认监视器
[root@node1 ~]# systemctl start DmWatcherServiceDM
[root@node2 ~]# systemctl start DmWatcherServiceDM
[root@node2 ~]# systemctl start DmMonitorServiceDM
达梦社区地址
https://eco.dameng.com