监控告警处理之 tidb_server_critical_error_total
作者: Soysauce520 原文来源:https://tidb.net/blog/7b595188
背景:
一、原理分析
官方文档 binlog.ignor-error 介绍

题外话:不要拉踩,Oracle DataGuard 是通过 archive 模式进行同步的,存在一个归档空间满,主库 hang 住的情况。相较于 Oracle,tidb 多了一个选择,可以丢弃归档日志保障主库业务的连续性,不保证下游数据和上游数据一致性。
二、现象
2.1 监控位置:Tidb—->server—->skip binlog count

2.2 curl http://127.0.0.1:10080/info/all

2.3 查看 binlog_status 状态,此时一般为 skipping
三、处理方式
考虑下游同步的三种情况,分别处理
情况一:同步任务取消
不再需要将数据同步到某个下游,所以下线对应的 Pump\Drainer。
编辑集群配置文件
tiup cluster edit-config {cluster_name}
打开集群配置文件,在 server_config 下,tidb 下添加或修改配置
binlog.enable: false
滚动重启 tidb-server
tiup cluster reload {cluster_name} -R tidb
执行命令
mysql -uroot -h {host} -P {port} -p {passwd} -e “SHOW CONFIG WHERE type =‘tidb’ and name like ‘binlog%’”
验证两指标 binlog.enable 和 binlog.ignore-error 的状态为 true
情况二:文件同步任务异常
drainer 同步方式为 file 文件,下游读取文件异常。
修复过程(二选一):
使用 tidb-server 的 API,然后尽快安排重新全备。
在 tidb 服务器上对 binlog 进行 recover,

重启 tidb-server,然后尽快安排重新全备。
情况三:灾备同步任务异常,官方文档
drainer 同步方式为 binlog 文件,灾备中备库数据异常。

恢复后查看监控 checkpoint 是否变化,若变化则正常。
四、skip binlog 出现的常见情况
3.1 pump 磁盘空间满了
导数时需要注意日志空间,同时需要关注 pump 中 stop-write-at-available-space 参数,默认为 10G。有可能不是空间满,而是 pump 参数设置不合理导致。

3.2 大事物超过 grpc 限制
引用官档

五、延伸问题
skip 的 binlog 如果存在 ddl,会导致 drainer 异常重启,报错 not found table id
社区案例:https://asktug.com/t/topic/575578/1
版权声明: 本文为 InfoQ 作者【TiDB 社区干货传送门】的原创文章。
原文链接:【http://xie.infoq.cn/article/e842e32aaf840a3f45d11c076】。文章转载请联系作者。
评论