TiDB 数据库健康检查报告

版本: 0.0.1

日期: {{print .Date}}

版权声明: 平凯星辰(北京)科技有限公司版权所有,保留一切权利。未经本公司许可,任何单位和个人不得擅自摘抄、复制本文档内容,并以任何形式传播。

一、 检查介绍

1.1 检查系统

  本次对用户的集群进行巡检,共计 {{index .SysStatistics.ServicePort "used"}} 个节点 {{if index .SysStatistics.ServicePort "failed" -}} , 其中有{{index .SysStatistics.ServicePort "failed"}}个节点不在线 {{- end}}。

服务汇总信息统计简表
集群名 {{.ClusterReport.OriData.ClusterInfo.ClusterName}}
集群 ID {{.ClusterReport.OriData.ClusterInfo.ClusterID}}
服务器数量 {{index .SysStatistics.ServicePort "used"}}

1.2 检测方法

  本次数据库巡检工具是:

  上述工具分析来自配置文件、工作日志以及 Prometheus 的数据,自动生成此报告。

1.3 检测范围

  这次检查对主机和数据库配置和数据库性能进行了总体分析,不针对具体某个应用性能。

  本报告提供的检查和建议不涉及具体的数据库安全分析和应用程序细节。

二、 检查总结

  系统总体运行情况: {{- if .SysStatistics.SummaryConclusionBad}} {{print .PriorKnowledge.Suggestions.SummaryConclusionNo}} {{else}} {{print .PriorKnowledge.Suggestions.SummaryConclusionYes}} {{- end}},系统资源使用如下:

  1. CPU 整体使用率在 {{with index .SysStatistics.HardwareUsageInfo "cpu_usage"}}{{printf "%.2f" .Mean99}}{{- end}}% 以下, {{$kn := .PriorKnowledge}} {{$sys := .SysStatistics}} {{with (index .SysStatistics.HardwareUsageInfo "cpu_usage") -}} {{if (len .Outliers) -}} {{print $kn.Suggestions.HaveOutliersYes}} {{range $time, $value := .Outliers -}}

    Time: {{ $time | $sys.TimestampParse | printf "%s" }}, cpu_usage: {{ $value | printf "%.2f"}}%

    {{- end}} {{else}} {{print $kn.Suggestions.HaveOutliersNo}} {{- end}} {{- end}}
  2. 内存整体使用率在 {{with index .SysStatistics.HardwareUsageInfo "memory_avaliable"}}{{printf "%.2f" .Mean99}}{{- end}}MB 以下, {{$kn := .PriorKnowledge}} {{$sys := .SysStatistics}} {{with (index .SysStatistics.HardwareUsageInfo "memory_avaliable") -}} {{if (len .Outliers) -}} {{print $kn.Suggestions.HaveOutliersYes}} {{range $time, $value := .Outliers -}}

    Time: {{ $time | $sys.TimestampParse | printf "%s" }}, memory_available: {{ $value | printf "%.2f"}}MB

    {{- end}} {{else}} {{print $kn.Suggestions.HaveOutliersNo}} {{- end}} {{- end}}
  3. I/O 整体使用率在 {{with index .SysStatistics.HardwareUsageInfo "network_traffic"}}{{printf "%.2f" .Mean99}}{{- end}}MB 以下, {{$kn := .PriorKnowledge}} {{$sys := .SysStatistics}} {{with (index .SysStatistics.HardwareUsageInfo "network_traffic") -}} {{if (len .Outliers) -}} {{print $kn.Suggestions.HaveOutliersYes}} {{range $time, $value := .Outliers -}}

    Time: {{ $time | $sys.TimestampParse | printf "%s" }}, network_traffic: {{ $value | printf "%.2f"}}MB

    {{- end}} {{else}} {{print $kn.Suggestions.HaveOutliersNo}} {{- end}} {{- end}}

  Clinic 巡检工具主要针对系统前一段时间和目前的一些运行情况进行检查,根据收集的信息进行分析并指出系统的运行情况及存在隐患,同时给出适当的建议。从预防的角度看,着重于避免已知故障,同时对保持系统良好运行提出建议。

三、 系统配置

3.1 系统概况

组件 数量 内存 (MB) CPU (核) 磁盘 (GB) 网卡 (Mbps)
TiDB {{.ClusterReport.GetTiDBNum}} {{with index .ClusterReport.CInfos "TiDB"}}{{print .MemorySize}}{{- end}} {{with index .ClusterReport.CInfos "TiDB"}}{{print .CpuCoresMin}}{{- end}} {{with index .ClusterReport.CInfos "TiDB"}}{{print .StorageDeviceSize}}{{- end}} {{with index .ClusterReport.CInfos "TiDB"}}{{print .NetworkSpeed}}{{- end}}
TiKV {{.ClusterReport.GetTiKVNum}} {{with index .ClusterReport.CInfos "TiKV"}}{{print .MemorySize}}{{- end}} {{with index .ClusterReport.CInfos "TiKV"}}{{print .CpuCoresMin}}{{- end}} {{with index .ClusterReport.CInfos "TiKV"}}{{print .StorageDeviceSize}}{{- end}} {{with index .ClusterReport.CInfos "TiKV"}}{{print .NetworkSpeed}}{{- end}}
PD {{.ClusterReport.GetPDNum}} {{with index .ClusterReport.CInfos "PD"}}{{print .MemorySize}}{{- end}} {{with index .ClusterReport.CInfos "PD"}}{{print .CpuCoresMin}}{{- end}} {{with index .ClusterReport.CInfos "PD"}}{{print .StorageDeviceSize}}{{- end}} {{with index .ClusterReport.CInfos "PD"}}{{print .NetworkSpeed}}{{- end}}
TiFlash {{.ClusterReport.GetTiFlashNum}} {{with index .ClusterReport.CInfos "TiFlash"}}{{print .MemorySize}}{{- end}} {{with index .ClusterReport.CInfos "TiFlash"}}{{print .CpuCoresMin}}{{- end}} {{with index .ClusterReport.CInfos "TiFlash"}}{{print .StorageDeviceSize}}{{- end}} {{with index .ClusterReport.CInfos "TiFlash"}}{{print .NetworkSpeed}}{{- end}}
Monitor {{.ClusterReport.GetMonitorNum}} {{with index .ClusterReport.CInfos "Monitor"}}{{print .MemorySize}}{{- end}} {{with index .ClusterReport.CInfos "Monitor"}}{{print .CpuCoresMin}}{{- end}} {{with index .ClusterReport.CInfos "Monitor"}}{{print .StorageDeviceSize}}{{- end}} {{with index .ClusterReport.CInfos "Monitor"}}{{print .NetworkSpeed}}{{- end}}
TiCDC {{.ClusterReport.GetTiCDCNum}} {{with index .ClusterReport.CInfos "TiCDC"}}{{print .MemorySize}}{{- end}} {{with index .ClusterReport.CInfos "TiCDC"}}{{print .CpuCoresMin}}{{- end}} {{with index .ClusterReport.CInfos "TiCDC"}}{{print .StorageDeviceSize}}{{- end}} {{with index .ClusterReport.CInfos "TiCDC"}}{{print .NetworkSpeed}}{{- end}}
TiSpark {{.ClusterReport.GetTiSparkNum}} {{with index .ClusterReport.CInfos "TiSpark"}}{{print .MemorySize}}{{- end}} {{with index .ClusterReport.CInfos "TiSpark"}}{{print .CpuCoresMin}}{{- end}} {{with index .ClusterReport.CInfos "TiSpark"}}{{print .StorageDeviceSize}}{{- end}} {{with index .ClusterReport.CInfos "TiSpark"}}{{print .NetworkSpeed}}{{- end}}

混合部署检查告警

{{if .TopologyChecker.Result -}} {{range $com, $result := .TopologyChecker.DeployCheck -}} {{range $dupcom, $ips := $result -}} {{if len $ips -}}

warn: 发现 {{$com}} 与 {{$dupcom}} 混合部署情况,混合部署IP: {{range $index, $ip := $ips -}}{{$ip | printf "%s "}}{{- end}} ,建议分开部署,目前的部署模式增加 {{$com}} 的性能风险, 并有可能引发 OOM。

{{- end}} {{- end}} {{- end}} {{else}}

未检查出混合部署情况

{{- end}}

3.2 操作系统

四、 数据库集群配置

4.1 TiDB 系统 Service 清单

4.2 组件清单配置

4.3 数据库配置

4.3.1 集群版本

  当前集群版本为: {{.ClusterReport.OriData.ClusterMeta.Version}}。

4.3.2 组件配置参数

4.4 集群运行状态概览

4.4.1 System Info 信息

4.4.2 PD Summary 信息

4.4.3 TiDB Summary 信息

4.4.4 TiKV Summary 信息

4.5 集群日志概览

{{if (len .LogAnalysis.LogSymptoms) -}} {{range $index, $symtom := .LogAnalysis.LogSymptoms -}}
  • RuleID: {{print $symtom.ID}}

    Name: {{print $symtom.Name}}

    Kibana: {{print $symtom.Kibana}}

    {{if len $symtom.KB -}}

    KB: {{print $symtom.KB}}

    {{- end}} {{if len $symtom.Jira -}}

    Jira: {{print $symtom.Jira}}

    {{- end}}
  • {{- end}} {{else}}

    {{print .PriorKnowledge.Suggestions.HaveOutliersNo}}

    {{- end}}

    5 数据库性能

    5.1 SQL 性能概览

      SQL 处理的总 Duration 时长,99 线平均值为 {{printf "%.2f" .SysStatistics.SqlInfo.Mean99}} 秒,999 线平均值为 {{printf "%.2f" .SysStatistics.SqlInfo.Mean99Plus}} 秒, {{$kn := .PriorKnowledge}} {{$sys := .SysStatistics}} {{if (len .SysStatistics.SqlInfo.Outliers) -}} {{print $kn.Suggestions.HaveOutliersYes}} {{range $time, $value := .SysStatistics.SqlInfo.Outliers -}}

    Time: {{ $time | $sys.TimestampParse | printf "%s" }}, Duration: {{ $value | printf "%.2f"}}s

    {{- end}} {{else}} {{print $kn.Suggestions.HaveOutliersNo}} {{- end}}

    5.2 慢 SQL 分析

    {{if (len .LogAnalysis.SlowSymptoms) -}} {{range $index, $symtom := .LogAnalysis.SlowSymptoms -}}
  • RuleID: {{print $symtom.RuleID}}

    Name: {{print $symtom.Name}}

    Kibana: {{print $symtom.Kibana}}

    {{if len $symtom.KB -}}

    KB: {{print $symtom.KB}}

    {{- end}} {{if len $symtom.Jira -}}

    Jira: {{print $symtom.Jira}}

    {{- end}}
  • {{- end}} {{else}}

      {{print .PriorKnowledge.Suggestions.HaveOutliersNo}}

    {{- end}}

    声明

      以上报告由 Clinic toolkit 自动生成,目前尚为测试版,未尽之处,强烈建议请人工复核。