Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dashboard Access, Overview and Profiling Page #3244

Merged
merged 17 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions dashboard/dashboard-access.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: 访问 TiDB Dashboard
category: how-to
---

# 访问 TiDB Dashboard

通过浏览器访问 <http://127.0.0.1:2379/dashboard> (请将 127.0.0.1:2379 替换为实际 PD 实例地址和端口)即可打开 TiDB Dashboard。
breezewish marked this conversation as resolved.
Show resolved Hide resolved

> **注意:**
>
> 部署了多个 PD 组件时,填写任意一个 PD 组件地址都可以访问 TiDB Dashboard,但其中仅有一个 PD 组件会真正运行 TiDB Dashboard。访问其他 PD 组件时浏览器都将会被重定向到该 PD 组件。因此若防火墙没有为这个运行 PD 的实例进行配置,可能会出现无法访问 TiDB Dashboard 的情况。

## 浏览器兼容性

TiDB Dashboard 可在常见的、更新及时的桌面浏览器中使用,具体版本号为:

- Chrome >= 77
- Firefox >= 68
- Edge >= 17

> **注意:**
>
> 若使用旧版本浏览器或其他浏览器访问 TiDB Dashboard,部分界面可能不能正常工作。

## 登录

首次访问 TiDB Dashboard 将会显示用户登录界面,如下图所示,可使用 TiDB root 账号登录。

![登录界面](/media/dashboard/access-login.png)

如果存在以下情况,则可能会登录失败:

- TiDB root 用户不存在
- PD 未启动或无法访问
- TiDB 未启动或无法访问
- root 密码错误

登录后,24 小时内将保持自动登录状态。参见[登出](#登出)章节了解如何登出用户。

## 切换语言

TiDB Dashboard 目前支持以下语言:

- 简体中文
- 英文

在登录界面中,可点击 Switch Language 下拉框切换界面显示语言:

![切换语言](/media/dashboard/access-switch-language.png)

## 登出

登录后,在左侧导航处点击登录用户名,可切换到用户页面。在用户页面点击 **登出**(Logout)按钮即可登出当前用户。登出后,需重新输入用户名密码。

![登出](/media/dashboard/access-logout.png)
Empty file.
Empty file.
94 changes: 94 additions & 0 deletions dashboard/dashboard-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
title: 概况页面
category: how-to
---

# 概况页面

该页面显示了整个集群的概况,包含以下信息:

- 整个集群的 QPS
- 整个集群的查询延迟
- 最近一段时间内累计耗时最多的若干 SQL 语句
- 最近一段时间内运行时间超过一定阈值的慢查询
- 各个实例的节点数和状态
- 监控及告警信息

## 访问

登录 TiDB Dashboard 后默认进入该页面,也可以左侧导航条点击**概况**(Overview)进入:

![访问](/media/dashboard/overview-access.png)

## QPS

该区域显示最近一小时整个集群的每秒成功和失败查询数量:

![界面](/media/dashboard/overview-qps.png)

> **注意:**
>
> 该功能仅在部署了 Prometheus 监控组件的集群上可用,未部署监控组件的情况下会显示为失败。

## 延迟

该区域显示最近一小时整个集群中 99.9%、99% 和 90% 查询的延迟:

![界面](/media/dashboard/overview-latency.png)

> **注意:**
>
> 该功能仅在部署了 Prometheus 监控组件的集群上可用,未部署监控组件的情况下会显示为失败。

## Top SQL 语句

该区域显示最近一段时间内整个群集中累计耗时最长的 10 类 SQL 语句。查询参数不一样但结构一样的 SQL 会归为同一类 SQL 语句,在同一行中显示:

![界面](/media/dashboard/overview-top-statements.png)

该区域显示的内容与 [SQL 语句分析页面](/dashboard/dashboard-statements-list.md)一致,可点击 **Top SQL 语句**(Top SQL Statements)标题查看完整列表。关于该表格中各列详情,见 [SQL 语句分析页面](/dashboard/dashboard-statements-list.md)。
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

> **注意:**
>
> 该功能仅在开启了 SQL 语句分析功能的集群上可用。

## 最近的慢查询

该区域默认显示最近 30 分钟内整个集群中最新的 10 条慢查询:

![界面](/media/dashboard/overview-slow-query.png)

默认情况下运行时间超过 300ms 的SQL 查询即会被计为慢查询并显示在该表格中。可通过调整 [tidb_slow_log_threshold](/tidb-specific-system-variables.md#tidb_slow_log_threshold) 变量或 TiDB [slow-threshold](/tidb-configuration-file.md#slow-threshold) 参数调整阈值。

该区域显示的内容与[慢查询页面](/dashboard/dashboard-slow-query.md)一致,可点击**最近的慢查询**(Recent Slow Queries)标题查看完整列表。关于该表格中各列详情,见[慢查询页面](/dashboard/dashboard-slow-query.md)。

> **注意:**
>
> 该功能仅在配置开启了慢查询日志的集群中可用,使用 Tiup 或 Ansible 部署的集群默认开启慢查询日志。

## 实例

该区域汇总显示了整个集群中 TiDB、TiKV、PD、TiFlash 的总实例数量及异常实例数量:

![界面](/media/dashboard/overview-instances.png)

状态描述如下:

- Up:实例运行正常(含下线中的存储实例)。
- Down:实例运行异常,例如网络无法连接、进程已崩溃等。

点击**实例**标题可进入[集群信息页面](/dashboard/dashboard-cluster-info.md)查看各个实例的详细运行状态。

## 监控和告警

该区域提供了便捷的链接方便用户查看详细监控或告警:

![界面](/media/dashboard/overview-monitor.png)

- **查看监控**链接:点击后跳转至 Grafana 页面,可查看集群详细监控信息。关于 Grafana 监控面板中各个详细监控指标的解释,参见[监控指标](/grafana-overview-dashboard.md)文档。
- **查看告警**链接:点击后跳转至 AlertManager 页面,可查看集群详细告警信息。当集群中已有告警时,告警数量将会直接显示在链接文本上。
- **运行诊断**链接:点击后跳转至集群诊断页面,参见[集群诊断页面](/dashboard/dashboard-diagnostics-access.md)了解详情。

> **注意:**
>
> **查看监控**链接仅在集群中部署了 Grafana 节点时可用,**查看告警**链接仅在集群中部署了 AlertManager 节点时可用。
52 changes: 52 additions & 0 deletions dashboard/dashboard-profiling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: 实例性能分析页面
category: how-to
---

# 实例性能分析页面

该功能允许用户对各个 TiDB、TiKV、PD 实例在不重启的情况下进行内部性能数据收集。收集到的性能数据可显示为火焰图或有向无环图,直观展现实例在性能收集的时间段内执行的各种内部操作及比例,快速了解该实例 CPU 资源消耗的主要内容。

## 访问

可以通过以下两种方法访问实例性能分析页面:

- 登录后,左侧导航条点击 **高级调试** → **实例性能分析**:

![访问](/media/dashboard/profiling-access.png)

- 在浏览器中访问 <http://127.0.0.1:2379/dashboard/#/instance_profiling>(将 127.0.0.1:2379 替换为任意实际 PD 地址和端口)。
breezewish marked this conversation as resolved.
Show resolved Hide resolved

## 开始性能分析

在实例性能分析页面,选择至少一个想要分析的目标实例,点击**开始分析**(Start Profiling)按钮即可开始性能分析:

![界面](/media/dashboard/profiling-start.png)

在开始性能分析前可以修改性能分析时长。性能分析所需时间取决于分析时长,默认为 30 秒。30 秒的性能分析大约需要 30 秒完成。

## 查看性能分析状态

开始性能分析后,可以看到实时性能分析状态和进度:

![界面](/media/dashboard/profiling-view-progress.png)

性能分析会在后台运行,刷新或退出当前页面不会终止已经运行的性能分析任务。

## 下载性能分析结果

所有实例的性能分析都完成后,可点击右上角下载按钮(Download Profiling Result)打包下载所有性能分析结果:

![界面](/media/dashboard/profiling-download.png)

也可以点击列表中的单个实例,直接查看其性能分析结果:

![界面](/media/dashboard/profiling-view-single.png)

## 查看性能分析历史

在性能分析页面下方,列出了性能分析历史。点击任意一行,即可查看其状态详情:

![界面](/media/dashboard/profiling-history.png)

关于状态详情页的操作,参见[查看性能分析状态](#查看性能分析状态)章节。
File renamed without changes.
Empty file.
Binary file added media/dashboard/access-login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/access-logout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/access-switch-language.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/overview-access.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/overview-instances.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/overview-latency.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/overview-monitor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/overview-qps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/overview-slow-query.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/overview-top-statements.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/profiling-access.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/profiling-download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/profiling-history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/profiling-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/profiling-view-progress.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dashboard/profiling-view-single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.