本文通过分析TiDB线上集群的一次业务问题,整理了故障排查的思路,结合这个案例也可以让有类似潜在威胁的同学提前规避 。
问题背景
线上某业务将数据导入新建物理分表,指定了shard_row_id_bit 以及 pre_split_region来避免热点 。几天后的凌晨,集群出现qps骤降和 duration 耗时异常 。
集群版本:v3.0.5
集群配置:普通SSD磁盘,128G内存,40 核cpu
tidb21 TiDB/PD/pump/prometheus/grafana/CCS
tidb22 TiDB/PD/pump
tidb23 TiDB/PD/pump
tidb01 TiKV
tidb02 TiKV
tidb03 TiKV
tidb04 TiKV
tidb05 TiKV
tidb06 TiKV
tidb07 TiKV
tidb08 TiKV
tidb09 TiKV
tidb10 TiKV
tidb11 TiKV
tidb12 TiKV
tidb13 TiKV
tidb14 TiKV
tidb15 TiKV
tidb16 TiKV
tidb17 TiKV
tidb18 TiKV
tidb19 TiKV
tidb20 TiKV
wtidb29 TiKV
wtidb30 TiKV
2问题现象和分析过程
6 月 21 日凌晨 01:24分左右,qps大幅骤降,durtation大幅增高,监听及报警包含如下:
集群region数量和大小上涨缓慢,且此时没有大规模region balance:
pd监控显示各节点磁盘消耗停滞:
tidb –> kv error 监控面板下面出现下述的告警信息:
上图中有出现server is busy,这可能是raftsotore线程卡了,导致消息没有及时处理,也可能是写入的事物过多,TiKV进行写入流控,可能是查询量过大,产生了堆积 。
通过监控我们定位到server is busy的节点,是ip为218结尾的这台机器出现了问题:
同时,218这个节点的pending commands也出现异常,其scheduler worker cpu也远高于其他节点 。
日志中未见异常,先将其重启 。
重启问题节点218后,能看到pending command和worker cpu转移了:
对TiKV的日志进行过滤:
cat 218.log| grep conflict | awk -F 'tableID=' '{print $2}' 都过滤下写冲突的 tableid
select * from information_schema.tables where tidb_table_id='93615';
["commit failed"] [conn=250060] ["finished txn"="Txn{state=invalid}"] [error="[kv:9007]Write conflict, txnStartTS=417517629610917903, conflictStartTS=417517692315762921, conflictCommitTS=417517692315762921, key={tableID=93643, indexID=1, indexValues={f73732b3d9f35742e39e6bba8e401192, www.baidu.com, }} primary={tableID=93643, indexID=1, indexValues={f73732b3d9f35742e39e6bba8e401192, www.baidu.com, }} [try again later]"]
[kv:9007]Write conflict, txnStartTS=417517629610917903, conflictStartTS=417517692315762921, conflictCommitTS=417517692315762921, key={tableID=93643, indexID=1, indexValues={f73732b3d9f35742e39e6bba8e401192, www.baidu.com, }} primary={tableID=93643, indexID=1, indexValues={f73732b3d9f35742e39e6bba8e401192, www.baidu.com, }} [try again later]"] [errorVerbose="[kv:9007]Write conflict, txnStartTS=417517629610917903, conflictStartTS=417517692315762921, conflictCommitTS=417517692315762921, key={tableID=93643, indexID=1, indexValues={f73732b3d9f35742e39e6bba8e401192, www.baidu.com, }} primary={tableID=93643, indexID=1, indexValues={f73732b3d9f35742e39e6bba8e401192, www.baidu.com, }} [try again later]
推荐阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 襄樊卖房一月能赚多少,卖房的最好时机
- 服务器芯片的三个战场,谁能笑傲江湖?
- 存储的未来:分布式存储、原子存储、DNA存储
- 分布式存储:边缘计算应用落地的催化剂
- 杭州嘉悦天地的电话是多少,嘉悦X7嘉悦X7实拍
- 台式机使用核显的方法,已有独立显卡如何使用核显
- 保险杠拆了再装会不会松动
- 《变形金刚》是如何拍出来的,如何拍摄机器零件
- 正时皮带没对准的表现
- 汽车顶上的盒子是什么