GaussDB (DWS) 集群均衡失败原理分析

集群均衡使用背景

一般用来在主实例发生故障,备机升主之后,待原主实例恢复正常后均衡集群。

触发场景

1)全部实例:cm_ctl switchover -a

2)指定实例:cm_ctl switchover -n nodeid -D 备机实例路径

前提:注意连接CN查看是否有catchup:

select * from pgxc_get_senders_catchup_time();

主备切换流程

 

1)gs_ctl发起switchover请求,备机postmaster收到信号(SIGUSR1),发送SIGUSR1信号给walreiver;

此时备机会提示日志: to do switchover

2)备机walreiver将switchover消息发送给主机walsender,并等待主机降备;

3)主机收到switchover消息,给主机postmaster线程发送降备信号(PMSIGNAL_DEMOTE_PRIMARY);

4)主机postmaster收到降备消息,重启相关线程;

降备完成后主机会提示日志:The WAL sender in primary has done the switchover waiting for the standby's promotion

5)备机升主后接管业务

主备切换关键日志

备机:

1)收到switchover信号:to do switchover

2)给主机发送switchover信号:send fast switchover request to primary

3)设置自身状态为waiting_state,等待主机降备:set db_state to WAITING_STATE in gaussdb state file

4)收到主机降备消息:received switchover response message from primary

5)设置自身状态为promoting_state,进行升主:set db_state to PROMOTING_STATE in gaussdb state file

 

主机:

1)收到备机switchover消息:received fast switchover request from standby

2)停止当前活跃事务:aborting any active transactions

3)停止连接:terminating connection due to administrator command

4)停止业务线程:could not fork new process for connection:postmaster is shutting down

5)给备机发送switchover响应消息:sending switchover response message

6)关闭所有线程,重新进行初始化:all server processes terminated; reinitializing

主备切换常见问题

【问题描述】

执行主备切换后长时间未成功,查询集群状态原主一直处于primary demoting状态,原备处于standby wait promoting状态

【问题分析】

查看原主实例降备过程中等待业务线程结束,此时业务线程消息未响应造成主备切换长时间不成功。

【修复方案】

Kill demoting实例进行回退待业务低峰期或停止业务后进行重新操作

 


合智互联客户成功服务热线:400-1565-661

admin
admin管理员

上一篇:GaussDB(DWS)性能调优系列实战篇三:十八般武艺之好味道表定义
下一篇:tensorflow张量的简单用法

留言评论

暂无留言
取消
扫码支持