暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

磐维数据库2.0系列:CM选主异常排查思路

#5z# 2024-01-07
636

磐维数据库,简称"PanWeiDB"。是中国移动信息技术中心首个基于中国本土开源数据库打造的面向ICT基础设施的自研数据库产品。其产品内核能力基于华为openGauss开源软件,并进一步提升了系统稳定性。

本文将介绍生产环境PanWeiDB高可用组件CM出现选主异常的处理思路及排查流程。

问题现象

CM 选主异常,三节点状态全为standby

排查思路

1)排查集群节点看时间是否同步
2)排查数据库日志以及cm日志
3)重启大法
4)删除dcc数据目录

删除dcc数据目录

以下步骤是删除dcc数据目录的详细操作步骤

1. 查询状态

1.1 查询cm状态

$ gs_om -t status --detail

image.png

1.2 查询dn状态

确保数据节点正常,如有异常需恢复后再继续进行下一步操作

$ gs_om -t query

image.png

2. 查询term

三个节点都查询,并记录term的最大值

PanWeiDB=# select term from pg_last_xlog_replay_location();

image.png

3. 所有节点注释crontab om_monitor进程

在所有节点执行:crontab -e,注释om_monitor进程定时任务

4. 停止所有节点CM相关的进程

4.1 首先确认抓取的进程是否正确

$ ps -xo pid,command | grep -E 'om_monitor|cm_agent|cm_server|fenced UDF' | grep -v grep

image.png

4.2 在所有节点同步执行

$ ps -xo pid,command | grep -E 'om_monitor|cm_agent|cm_server|fenced UDF' | grep -v grep | awk '{print $1}' | xargs kill -9

5. 删除dcf_data目录和gstor目录

5.1 确认dcf_data、gstor 路径是否正确

$ ll /database/panweidb/cm/dcf_data $ ll /database/panweidb/cm/gstor

5.2将dcf_data、gstor进行备份

在所有节点执行

$ mv /database/panweidb/cm/dcf_data /database/panweidb/cm/dcf_data_1121bak1 $ mv /database/panweidb/cm/gstor /database/panweidb/cm/gstor_1121bak1

确认操作是否成功

$ ll /database/panweidb/cm/

image.png

6. 所有节点节点启动 om_monitor,查看状态

在所有节点执行(crontab里的语句):

$ nohup /database/panweidb/app/bin/om_monitor -L /database/panweidb/log/omm/cm/om_monitor >>/dev/null 2>&1 &

7. 查询集群状态确保CM存在主节点

在任一节点执行:

$ cm_ctl query -Civdp 或 gs_om -t status --detail

注意:若集群状态异常,可执行cm_ctl start手动启动集群

8. 设置CM集群term值,并查询确认生效

在主节点执行:

注:将term值设置为比第2步中查询到的term值大的值,加100 后 修改到蓝色数字位置

$ cm_ctl ddb --put /omm/CMServer/status_key/term 903

在主节点执行:

$ cm_ctl ddb --get / --prefix

image.png

9. 恢复所有节点om_monitor进程定时任务

在所有节点执行:crontab -e,取消om_monitor进程定时任务注释

10. 在集群所有节点检查CM集群DCC日志

确保所有节点的DCC日志中没有持续报错

$ tail -f /database/panweidb/log/omm/cm/dcc/debug/dcc.dlog

注意:如任一节点DCC日志中持续出现类似以下报错,可判断CM集群DCC数据需要清理

$ tail -f /database/panweidb/log/omm/cm/dcc/debug/dcc.dlog UTC+8 2023-06-26 09:29:59.876|DCF|3330533|**ERROR**>[REP]stg_append_entry failed, log0 index=8100 [rep_follower.c:92] UTC+8 2023-06-26 09:30:00.532|DCC|3330713|**ERROR**>[EXC] Exc waits db commit timeout for time:3000 ms, wait_index:8144 db_commit_index:0 [executor.c:963] UTC+8 2023-06-26 09:30:00.532|DCC|3330713|**ERROR**>[API] executor error found, err_no:1404, err_msg:Wait local commit index timeout [util_error.c:125] UTC+8 2023-06-26 09:30:00.533|DCC|3330713|**ERROR**>[API] exc get failed or eof, ret:-1 eof:0 [srv_api.c:485] UTC+8 2023-06-26 09:30:00.876|DCF|3330533|**ERROR>**[STG]Log index 8100 is not contiguous 1 [stream.c:220] UTC+8 2023-06-26 09:30:00.876|DCF|3330533|**ERROR>**[REP]stg_append_entry failed, log0 index=8100 [rep_follower.c:92] UTC+8 2023-06-26 09:30:01.877|DCF|3330533|**ERROR**>[STG]Log index 8100 is not contiguous 1 [stream.c:220] UTC+8 2023-06-26 09:30:01.877|DCF|3330533|**ERROR**>[REP]stg_append_entry failed, log0 index=8100 [rep_follower.c:92] UTC+8 2023-06-26 09:30:02.877|DCF|3330533|ERROR>[STG]Log index 8100 is not contiguous 1 [stream.c:220] UTC+8 2023-06-26 09:30:02.877|DCF|3330533|ERROR>[REP]stg_append_entry failed, log0 index=8100 [rep_follower.c:92] UTC+8 2023-06-26 09:30:03.695|DCC|3330704|ERROR>[EXC] Exc waits db commit timeout for time:3000 ms, wait_index:8144 db_commit_index:0 [executor.c:963] UTC+8 2023-06-26 09:30:03.695|DCC|3330704|ERROR>[API] executor error found, err_no:1404, err_msg:Wait local commit index timeout [util_error.c:125] UTC+8 2023-06-26 09:30:03.695|DCC|3330704|ERROR>[API] exc get failed or eof, ret:-1 eof:0 [srv_api.c:485] UTC+8 2023-06-26 09:30:03.877|DCF|3330533|ERROR>[STG]Log index 8100 is not contiguous 1 [stream.c:220] UTC+8 2023-06-26 09:30:03.877|DCF|3330533|ERROR>[REP]stg_append_entry failed, log0 index=8100 [rep_follower.c:92] UTC+8 2023-06-26 09:30:04.877|DCF|3330533|ERROR>[STG]Log index 8100 is not contiguous 1 [stream.c:220] UTC+8 2023-06-26 09:30:04.877|DCF|3330533**|ERROR**>[REP]stg_append_entry failed, log0 index=8100 [rep_follower.c:92] UTC+8 2023-06-26 09:30:05.878|DCF|3330533|ERROR>[STG]Log index 8100 is not contiguous 1 [stream.c:220] UTC+8 2023-06-26 09:30:05.878|DCF|3330533|ERROR>[REP]stg_append_entry failed, log0 index=8100 [rep_follower.c:92] UTC+8 2023-06-26 09:30:06.864|DCC|3330712|ERROR>[EXC] Exc waits db commit timeout for time:3000 ms, wait_index:8144 db_commit_index:0 [executor.c:963] UTC+8 2023-06-26 09:30:06.864|DCC|3330712|ERROR>[API] executor error found, err_no:1404, err_msg:Wait local commit index timeout [util_error.c:125] UTC+8 2023-06-26 09:30:06.864|DCC|3330712|ERROR>[API] exc get failed or eof, ret:-1 eof:0 [srv_api.c:485] UTC+8 2023-06-26 09:30:06.878|DCF|3330533|ERROR>[STG]Log index 8100 is not contiguous 1 [stream.c:220] UTC+8 2023-06-26 09:30:06.878|DCF|3330533|ERROR>[REP]stg_append_entry failed, log0 index=8100 [rep_follower.c:92]
最后修改时间:2024-01-22 18:59:47
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论