其他分享
首页 > 其他分享> > 达梦主备手工切换(switchover)

达梦主备手工切换(switchover)

作者:互联网

环境:
OS:Centos 7
DB:DM8

 

1.启动监视器
在监视器配置文件dmmonintor.ini中,修改MON_DW_CONFIRM参数配置为0
dmmonitor /dmdbms/data/slnngk/dmmonitor.ini
若监视器已经启动的话,可以或略这一步

su - dmdba
[dmdba@host135 ~]$ dmmonitor /dmdbms/data/slnngk/dmmonitor.ini
[monitor]         2022-07-26 09:36:45: DMMONITOR[4.0] V8
[monitor]         2022-07-26 09:36:45: DMMONITOR[4.0] IS READY.

[monitor]         2022-07-26 09:36:45: Received message from(SLNNGK)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2022-07-26 09:36:45  OPEN           OK        SLNNGK           OPEN        PRIMARY   VALID    16       424687          424688          

[monitor]         2022-07-26 09:36:45: Received message from(SLNNGKBAK)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2022-07-26 09:36:45  OPEN           OK        SLNNGKBAK        OPEN        STANDBY   VALID    16       424686          424686          

 

2.输入show命令查看目前集群状态,其中group GRP1为集群的组名,当前主备集群状态正常,SLNNGK实例为primary,SLNNGKBAK为standby
我这里的mode是设置manual手工切换的

show
2022-07-26 09:37:25 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             453332      FALSE           MANUAL          FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.1.135       52141        2022-07-26 09:37:24  GLOBAL    VALID     OPEN           SLNNGK           OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.1.135       5236       OK        SLNNGK           OPEN        PRIMARY   0          0            REALTIME  VALID    377284          424700          377284          424701          NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.1.134       52141        2022-07-26 09:37:24  GLOBAL    VALID     OPEN           SLNNGKBAK        OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.1.134       5236       OK        SLNNGKBAK        OPEN        STANDBY   0          0            REALTIME  VALID    62839           424699          62839           424699          NONE                  

DATABASE(SLNNGKBAK) APPLY INFO FROM (SLNNGK), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[377283, 377283, 377284], (RLSN, SLSN, KLSN)[424699, 424699, 424700], N_TSK[0], TSK_MEM_USE[512] 
REDO_LSN_ARR: (424699)


#================================================================================#

 

3.登陆监视器
输入login 登陆监视器,然后输入用户名和密码(dameng123)
login
username:sysdba
password:
[monitor] 2022-07-26 09:39:46: Login dmmonitor success!

 

4.查看可切换节点
输入choose switchover GRP1 查看集群可以切换的节点(GRP_DW为集群的分组名称),通过该命令查看到DW1实例节点可以作为primary节点进行切换。

choose switchover GRP1
Can choose one of the following instances to do switchover:
1: SLNNGKBAK

 

5.切换节点
输入switchover SLNNGKBAK回车,集群开始进行主备切换
switchover SLNNGKBAK

 

6.检查是否已经切换

show
2022-07-26 09:42:30 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             453332      FALSE           MANUAL          FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.1.134       52141        2022-07-26 09:42:30  GLOBAL    VALID     OPEN           SLNNGKBAK        OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.1.134       5236       OK        SLNNGKBAK        OPEN        PRIMARY   0          0            REALTIME  VALID    377386          426111          377386          426111          NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.1.135       52141        2022-07-26 09:42:30  GLOBAL    VALID     OPEN           SLNNGK           OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.1.135       5236       OK        SLNNGK           OPEN        STANDBY   0          0            REALTIME  VALID    377376          426110          377376          426110          NONE                  

DATABASE(SLNNGK) APPLY INFO FROM (SLNNGKBAK), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[377385, 377385, 377386], (RLSN, SLSN, KLSN)[426110, 426110, 426111], N_TSK[0], TSK_MEM_USE[512] 
REDO_LSN_ARR: (426110)

 

标签:switchover,OK,手工,达梦主备,VALID,INST,DW,OPEN,DSC
来源: https://www.cnblogs.com/hxlasky/p/16519798.html