×
技术社区 >  技术博客 >  OCP 4.3.3 用 OceanBase 遇监控异常?快速关停 P99 采集指南

OCP 4.3.3 用 OceanBase 遇监控异常?快速关停 P99 采集指南

问题现象

OceanBase 数据库的basic exporter 突然处于 inactive 状态,这直接导致数据库关键监控数据断联,无法及时掌握集群运行健康度,给运维工作带来极大隐患。

版本:OCP 版本 4.3.3

问题原因

经过技术团队排查,症结在于 OCP 4.3.3 版本新增的 P99 延迟采集功能,该功能开启后,内核返回的监控数据量太大,导致 agent 处理超时,最终引发 exporter 异常下线。

目前该问题已在 OCP 4.3.4 版本中完成优化修复。但对于暂时无法升级版本,又急需恢复监控的用户,我们整理了一套「暂时关闭 P99 采集」的应急操作方法。

解决方案

操作方法如下:

  • 1.在主机上新建⼀个tmp目录,将/home/admin/ocp_agent/conf/module_config/monitor_ob.yaml 拷贝到tmp目录下,同时建议另外建⼀个backup目录先备份下这个配置文件。

  • 2.修改 monitor_ob.yaml 的内容,在ob_query_rt 的采集配置下增加 “disabled: true”来停止该指标的采集,即下面截图中的内容

  • 3.在 tmp 目录下创建⼀个push.py 的执行推送的脚本,脚本内容如下:
#!/usr/bin/python  
import base64  
import json  
import http.client  
import sys  
defmain():  
    host = sys.argv\[1\]  
    userPswd = sys.argv\[2\]  
    op = sys.argv\[3\].lower()  
    c = http.client.HTTPConnection(host)  
    header = {  
        "Authorization": "Basic " + base64.b64encode(userPswd.encode()).decode(),  
        "Content-Type":"application/json"  
    }  
    ifop== "get":  
        c.request("GET", "/api/v2/compute/hospits/moduleConfigChanges", None, header)  
    else:  
        fileName = sys.argv\[4\]  
        content = ""  
        ifop== "set":  
            content = sys.stdin.read()  
            print("%s %s" % (op, fileName))  
            q = {  
                "changes":\[{  
                    "operation": op,  
                    "scopeType":"global",  
                    "scope":"",  
                    "fileName": fileName,  
                    "content": content,  
                }\]  
            }  
            body = json.dumps(q)  
            c.request("POST", "/api/v2/compute/hospits/moduleConfigChanges", body, header)  
    r = c.getresponse()  
    print(r.status)  
    print(r.read().decode())  
if\_\_name\_\_== '\_\_main\_\_':  
    main()

4.依次执行下面两条命令推送配置⽂件,需要将命令中的ip、port、username、password 替换成OCP的ip、端口、用户名、密码。

python push.py ip:port username:password set monitor\_ob.yaml < monitor\_ob.yaml  

5.然后到主机上确认下agent的 monitor_ob.yaml 中的内容是否已经更新;

6.最后需要到OCP metadb 中compute_host_agent_module_config_change 表里的对应记录删除,否则会影响后⾯的ocp-agent升级。执行语句如下:

deletefrom compute\_host\_agent\_module\_config\_change where file\_name in ('monitor\_ob.yaml');  

7.重启ocp_agent

以上就是 OceanBase 数据库在 OCP 4.3.3 版本中,因 P99 延迟采集导致 agent 超时、basic exporter inactive 时,暂时关停 P99 采集的完整方案。若你正受此问题困扰,可按步骤操作缓解故障;

如果你在使用 OceanBase 时也遇到过类似的难题,或是有独到的优化经验,欢迎在评论区留言分享,我们一起探讨解决方案。后续我们还会持续分享 OceanBase 数据库的运维技巧与故障排查方案,助力你的技术之路少走弯路。下次见!

精选推荐