TiFlash 重启,内存&CPU 资源耗尽,系统卡死

【 TiDB 使用环境】生产环境
【 TiDB 版本】6.5.1
【复现路径】对部分表开起tiflash
【遇到的问题:问题现象及影响】重启 其中一个节点的 tiflash 出现,cpu & 内存资源耗尽,系统卡死,tiflash 无法启动情况
【资源配置】

【附件:截图/日志/监控】

有两台tiflash 分配47G ,其中一台重启后恢复正常 可用内存

剩下一台,重启就会导致 cpu&内存耗尽,然后系统卡死,tiflash 也无法启动

查看出问题的tiflash 节点 tiflash_error 日志,打印如下日志,后系统就卡死
[2024/06/13 18:29:31.326 +08:00] [WARN] [StorageConfigParser.cpp:241] [“The configuration "path" is deprecated. Check [storage] section for new style.”] [thread_id=1]
[2024/06/13 18:29:47.022 +08:00] [WARN] [DMFile.cpp:732] [“Existing temporary or dropped dmfile, removed: /data1/tidb-data/tiflash-9000/data/t_21836383/stable/.tmp.dmf_10142635”] [source=DMFile] [thread_id=51]
[2024/06/13 18:30:52.892 +08:00] [WARN] [SchemaGetter.cpp:208] [“The schema diff for version 11163789, key Diff:11163789 is empty.”] [source=SchemaGetter] [thread_id=54]
[2024/06/13 18:39:21.252 +08:00] [WARN] [StorageConfigParser.cpp:241] [“The configuration "path" is deprecated. Check [storage] section for new style.”] [thread_id=1]
[2024/06/13 18:39:37.601 +08:00] [WARN] [DMFile.cpp:732] [“Existing temporary or dropped dmfile, removed: /data1/tidb-data/tiflash-9000/data/t_21836383/stable/.tmp.dmf_10142639”] [source=DMFile] [thread_id=51]
[2024/06/13 18:50:22.504 +08:00] [WARN] [StorageConfigParser.cpp:241] [“The configuration "path" is deprecated. Check [storage] section for new style.”] [thread_id=1]
[2024/06/13 18:50:39.733 +08:00] [WARN] [DMFile.cpp:732] [“Existing temporary or dropped dmfile, removed: /data1/tidb-data/tiflash-9000/data/t_21836383/stable/.tmp.dmf_10142643”] [source=DMFile] [thread_id=51]
[2024/06/13 19:05:44.285 +08:00] [ERROR] [] [“get member failed: 4: Deadline Exceeded”] [source=pingcap.pd] [thread_id=99]
[2024/06/13 19:05:44.302 +08:00] [WARN] [PageDirectory.cpp:1519] [“Meet a stale snapshot [thread id=64] [tracing id=write] [seq=91675760] [alive time(s)=819.093752026]”] [source=global.meta] [thread_id=69]
[2024/06/13 19:05:44.302 +08:00] [WARN] [PageDirectory.cpp:1519] [“Meet a stale snapshot [thread id=97] [tracing id=write] [seq=91675776] [alive time(s)=818.760227131]”] [source=global.meta] [thread_id=69]
[2024/06/13 19:05:44.312 +08:00] [WARN] [] [“failed to get cluster id by :http://xxxx:2379”] [source=pingcap.pd] [thread_id=99]
[2024/06/13 19:05:44.363 +08:00] [ERROR] [] [“Send TsoRequest failed”] [source=pingcap.pd] [thread_id=102]
[2024/06/13 19:05:44.364 +08:00] [WARN] [PageDirectory.cpp:1519] [“Meet a stale snapshot [thread id=64] [tracing id=write] [seq=21915395] [alive time(s)=819.180260066]”] [source=global.data] [thread_id=69]
[2024/06/13 19:05:44.365 +08:00] [WARN] [PageDirectory.cpp:1519] [“Meet a stale snapshot [thread id=97] [tracing id=write] [seq=21915397] [alive time(s)=818.823370803]”] [source=global.data] [thread_id=69]
[2024/06/13 19:05:44.403 +08:00] [WARN] [] [“update ts error: Exception: Send TsoRequest failed”] [source=pd/oracle] [thread_id=102]

请问遇到这种问题,是怎么解决的

你这个看起来是连不上pd啊

启动后 内存,CPU 耗尽,系统卡死后,跟外部都无法通信,会报请求不到 pd 的tso 的信息。 不清楚为什么会内存,cpu 耗尽,有什么办法解决?

https://docs.pingcap.com/zh/tidb/v6.5/tiflash-configuration
把内存相关的参数改小一些在启动看看。

将开启了tiflash ,显示不可用状态的表,关掉tiflash ,经历一段时间系统卡死后,内存&cpu 恢复正常,tiflash 正常启动了

【资源配置】进入到 TiDB Dashboard -集群信息 (Cluster Info) -主机(Hosts) 截图此页面

这个截图看看~

tiflash那台机器磁盘容量为啥这么低。

显示监控的路径 不是数据盘路径,实际数据目录占用空间70多G

  1. tiflash 服务器不推荐开 swap,关掉吧。
  2. 配置下内存:https://docs.pingcap.com/zh/tidb/stable/tiflash-configuration
    主要是:
    ## 单次查询过程中,节点对中间数据的内存限制
    ## 设置为整数时,单位为 byte,比如 34359738368 表示 32 GiB 的内存限制,0 表示无限制
    ## 设置为 [0.0, 1.0) 之间的浮点数时,指节点总内存的比值,比如 0.8 表示总内存的 80%,0.0 表示无限制
    ## 默认值为 0,表示不限制
    ## 当查询试图申请超过限制的内存时,查询终止执行并且报错
    max_memory_usage = 0

    ## 所有查询过程中,节点对中间数据的内存限制
    ## 设置为整数时,单位为 byte,比如 34359738368 表示 32 GiB 的内存限制,0 表示无限制
    ## 设置为 [0.0, 1.0) 之间的浮点数时,指节点总内存的比值,比如 0.8 表示总内存的 80%,0.0 表示无限制
    ## 默认值为 0.8,表示总内存的 80%
    ## 当查询试图申请超过限制的内存时,查询终止执行并且报错
    max_memory_usage_for_all_queries = 0.8

还有服务器资源用满卡主可以考虑服务器做一些限制。比如 OOM 相关配置。让系统杀大内存进程。比服务器卡主要好。。。