-
Notifications
You must be signed in to change notification settings - Fork 1.2k
reference/system-databases: add 12 new documents for sql diagnosis #2522
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
Merged
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
a55b158
add sql-dignosis
reafans 0ceb83a
fmt
reafans 5e0f48a
fix lint
reafans 5640320
Merge branch 'master' into sql-dignosis
reafans 8d703b7
fix lint
reafans ef6f2e8
Merge branch 'sql-dignosis' of https://github.com/reafans/docs-cn int…
reafans 879ba0a
split the sql-dignosis doc
reafans 2934e47
refine doc
reafans a3b172c
fix lint
reafans 1be1aa5
Merge branch 'master' into sql-dignosis
reafans 2545f7a
add meta info
reafans e5a55d4
Merge branch 'sql-dignosis' of https://github.com/reafans/docs-cn int…
reafans f44276f
Merge branch 'master' of https://github.com/pingcap/docs-cn into sql-…
reafans fab9543
add æsql copy
reafans edc30e5
refine doc
reafans 91e2f47
Update reference/system-databases/sql-dignosis.md
crazycs520 236de52
Update reference/system-databases/sql-dignosis.md
crazycs520 7cbbe98
Update reference/system-databases/sql-dignosis.md
crazycs520 aaf04b6
Update reference/system-databases/sql-dignosis.md
crazycs520 76df3ee
Update reference/system-databases/cluster_hardware.md
crazycs520 76a7273
Update reference/system-databases/cluster_hardware.md
crazycs520 de9d5dd
Update reference/system-databases/cluster_hardware.md
crazycs520 c440c78
Update reference/system-databases/cluster_info.md
crazycs520 276f099
Update reference/system-databases/cluster_info.md
crazycs520 4a1607d
Update reference/system-databases/sql-dignosis.md
reafans 742c352
Update reference/system-databases/sql-dignosis.md
reafans bba068d
Update reference/system-databases/cluster_info.md
reafans ee5ca59
Update reference/system-databases/sql-dignosis.md
reafans 8711f0e
Update reference/system-databases/cluster_info.md
reafans b49a460
Update reference/system-databases/cluster_log.md
reafans a6c75f9
Update reference/system-databases/cluster_hardware.md
reafans 0514530
address comment
reafans f4a674d
Merge branch 'master' of https://github.com/pingcap/docs-cn into sql-…
reafans 04df9fa
refine doc
reafans 943a9f2
refine punctuations and wording
TomShawn 5e000e8
Merge branch 'master' into sql-dignosis
crazycs520 bc211ce
add more docs
crazycs520 a9224d8
Update reference/system-databases/sql-dignosis.md
crazycs520 2130a4e
Update reference/system-databases/sql-dignosis.md
crazycs520 40e2917
Merge branch 'sql-dignosis' of https://github.com/reafans/docs-cn int…
crazycs520 0277006
Merge branch 'master' of https://github.com/pingcap/docs-cn into sql-…
reafans 452ef15
add sys tables to TOC
reafans d472c80
Merge branch 'sql-dignosis' of https://github.com/reafans/docs-cn int…
reafans b0862be
fix lint
reafans bef374e
Update reference/system-databases/sql-diagnosis.md
crazycs520 45b1d8e
update metrics_schema docs
crazycs520 e817985
add reference links and change file names
TomShawn 344a622
Merge branch 'sql-dignosis' of https://github.com/reafans/docs-cn int…
TomShawn f46db32
fix dead links
TomShawn 5f30f52
Update reference/system-databases/cluster-config.md
reafans ccb0a64
Update TOC.md
reafans 2f0a3c9
Delete SELECT GREATEST(t1.avg_value,.sql
reafans 0ac939b
reference: add summaries for newly added docs
TomShawn 3cd1fe6
Merge branch 'master' into sql-dignosis
reafans eac7895
toc: fix a link placement issue
lilin90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| --- | ||
| title: CLUSTER_CONFIG | ||
| category: reference | ||
| summary: 了解 TiDB 集群配置表 `CLUSTER_CONFIG`。 | ||
| --- | ||
lilin90 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # CLUSTER_CONFIG | ||
|
|
||
| 集群配置表 `CLUSTER_CONFIG` 用于获取集群当前所有 TiDB/PD/TiKV 节点的配置。对于 TiDB 4.0 以前的版本,用户需要逐个访问各个节点的 HTTP API 才能收集到所有组件配置。 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| desc cluster_config; | ||
| ``` | ||
|
|
||
| ``` | ||
| +----------+--------------+------+------+---------+-------+ | ||
| | Field | Type | Null | Key | Default | Extra | | ||
| +----------+--------------+------+------+---------+-------+ | ||
| | TYPE | varchar(64) | YES | | NULL | | | ||
| | INSTANCE | varchar(64) | YES | | NULL | | | ||
| | KEY | varchar(256) | YES | | NULL | | | ||
| | VALUE | varchar(128) | YES | | NULL | | | ||
| +----------+--------------+------+------+---------+-------+ | ||
| ``` | ||
|
|
||
| 字段解释: | ||
|
|
||
| * `TYPE`:节点的类型,可取值为 `tidb`,`pd` 或 `tikv`。 | ||
| * `INSTANCE`:节点的服务地址。 | ||
| * `KEY`:配置项名。 | ||
| * `VALUE`:配置项值。 | ||
|
|
||
| 以下示例查询 TiKV 节点的 `coprocessor` 相关配置: | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| select * from cluster_config where type='tikv' and `key` like 'coprocessor%'; | ||
| ``` | ||
|
|
||
| ``` | ||
| +------+-----------------+-----------------------------------+----------+ | ||
| | TYPE | INSTANCE | KEY | VALUE | | ||
| +------+-----------------+-----------------------------------+----------+ | ||
| | tikv | 127.0.0.1:20160 | coprocessor.batch-split-limit | 10 | | ||
| | tikv | 127.0.0.1:20160 | coprocessor.region-max-keys | 1.44e+06 | | ||
| | tikv | 127.0.0.1:20160 | coprocessor.region-max-size | 144MiB | | ||
| | tikv | 127.0.0.1:20160 | coprocessor.region-split-keys | 960000 | | ||
| | tikv | 127.0.0.1:20160 | coprocessor.region-split-size | 96MiB | | ||
| | tikv | 127.0.0.1:20160 | coprocessor.split-region-on-table | false | | ||
| +------+-----------------+-----------------------------------+----------+ | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| title: CLUSTER_HARDWARE | ||
| summary: 了解 TiDB 集群配置表 `CLUSTER_HARDWARE`。 | ||
| category: reference | ||
| --- | ||
|
|
||
| # CLUSTER_HARDWARE | ||
|
|
||
| 集群硬件表 `CLUSTER_HARDWARE` 提供了集群各节点所在服务器的硬件信息。 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| desc cluster_hardware; | ||
| ``` | ||
|
|
||
| ``` | ||
| +-------------+--------------+------+------+---------+-------+ | ||
| | Field | Type | Null | Key | Default | Extra | | ||
| +-------------+--------------+------+------+---------+-------+ | ||
| | TYPE | varchar(64) | YES | | NULL | | | ||
| | INSTANCE | varchar(64) | YES | | NULL | | | ||
| | DEVICE_TYPE | varchar(64) | YES | | NULL | | | ||
| | DEVICE_NAME | varchar(64) | YES | | NULL | | | ||
| | NAME | varchar(256) | YES | | NULL | | | ||
| | VALUE | varchar(128) | YES | | NULL | | | ||
| +-------------+--------------+------+------+---------+-------+ | ||
| ``` | ||
|
|
||
| 字段解释: | ||
|
|
||
| * `TYPE`:对应节点信息表 `information_schema.cluster_info` 中的 `TYPE` 字段,可取值为 `tidb`,`pd` 或 `tikv`。 | ||
| * `INSTANCE`:对应于节点信息表 `information_schema.cluster_info` 中的 `STATUS_ADDRESS` 字段。 | ||
| * `DEVICE_TYPE`:硬件类型。目前可以查询的硬件类型有 `cpu`、`memory`、`disk` 和 `net`。 | ||
| * `DEVICE_NAME`:硬件名。对于不同的 `DEVICE_TYPE`,`DEVICE_NAME` 的取值不同。 | ||
| * `cpu`:硬件名为 cpu。 | ||
| * `memory`:硬件名为 memory。 | ||
| * `disk`:磁盘名。 | ||
| * `net`:网卡名。 | ||
| * `NAME`:硬件不同的信息名,比如 cpu 有 `cpu-logical-cores` , `cpu-physical-cores` 两个信息名,表示逻辑核心数量和物理核心数量。 | ||
| * `VALUE`:对应硬件信息的值。例如磁盘容量和 CPU 核数。 | ||
|
|
||
| 查询集群 CPU 信息的示例如下: | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| select * from cluster_hardware where device_type='cpu' and device_name='cpu' and name like '%cores'; | ||
| ``` | ||
|
|
||
| ``` | ||
| +------+-----------------+-------------+-------------+--------------------+-------+ | ||
| | TYPE | INSTANCE | DEVICE_TYPE | DEVICE_NAME | NAME | VALUE | | ||
| +------+-----------------+-------------+-------------+--------------------+-------+ | ||
| | tidb | 127.0.0.1:10080 | cpu | cpu | cpu-logical-cores | 8 | | ||
| | tidb | 127.0.0.1:10080 | cpu | cpu | cpu-physical-cores | 4 | | ||
| | pd | 127.0.0.1:2379 | cpu | cpu | cpu-logical-cores | 8 | | ||
| | pd | 127.0.0.1:2379 | cpu | cpu | cpu-physical-cores | 4 | | ||
| | tikv | 127.0.0.1:20160 | cpu | cpu | cpu-logical-cores | 8 | | ||
| | tikv | 127.0.0.1:20160 | cpu | cpu | cpu-physical-cores | 4 | | ||
| +------+-----------------+-------------+-------------+--------------------+-------+ | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| --- | ||
| title: CLUSTER_INFO | ||
| summary: 了解 TiDB 集群配置表 `CLUSTER_INFO`。 | ||
| category: reference | ||
| --- | ||
|
|
||
| # CLUSTER_INFO | ||
|
|
||
| 集群拓扑表 `CLUSTER_INFO` 提供集群当前的拓扑信息,以及各个节点的版本信息、版本对应的 Git Hash、各节点的启动时间、各节点的运行时间。 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| desc cluster_info; | ||
| ``` | ||
|
|
||
| ``` | ||
| +----------------+-------------+------+------+---------+-------+ | ||
| | Field | Type | Null | Key | Default | Extra | | ||
| +----------------+-------------+------+------+---------+-------+ | ||
| | TYPE | varchar(64) | YES | | NULL | | | ||
| | INSTANCE | varchar(64) | YES | | NULL | | | ||
| | STATUS_ADDRESS | varchar(64) | YES | | NULL | | | ||
| | VERSION | varchar(64) | YES | | NULL | | | ||
| | GIT_HASH | varchar(64) | YES | | NULL | | | ||
| | START_TIME | varchar(32) | YES | | NULL | | | ||
| | UPTIME | varchar(32) | YES | | NULL | | | ||
| +----------------+-------------+------+------+---------+-------+ | ||
| 7 rows in set (0.00 sec) | ||
| ``` | ||
|
|
||
| 字段解释: | ||
|
|
||
| * `TYPE`:节点类型,目前节点的可取值为 `tidb`,`pd` 或 `tikv`。 | ||
| * `INSTANCE`:实例地址,为 `IP:PORT` 格式的字符串。 | ||
| * `STATUS_ADDRESS`:HTTP API 的服务地址。部分 `tikv-ctl`、`pd-ctl` 或 `tidb-ctl` 命令会使用到 HTTP API 和该地址。用户也可以通过该地址获取一些额外的集群信息,详情可参考 HTTP API 官方文档。 | ||
| * `VERSION`:对应节点的语义版本号。TiDB 版本为了兼容 MySQL 的版本号,以 `${mysql-version}-${tidb-version}` 的格式展示版本号。 | ||
| * `GIT_HASH`:编译节点版本时的 Git Commit Hash,用于识别两个节点是否是绝对一致的版本。 | ||
| * `START_TIME`:对应节点的启动时间。 | ||
| * `UPTIME`:对应节点已经运行的时间。 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| select * from cluster_info; | ||
| ``` | ||
|
|
||
| ``` | ||
| +------+-----------------+-----------------+----------------------------------------+------------------------------------------+---------------------------+--------------+ | ||
| | TYPE | INSTANCE | STATUS_ADDRESS | VERSION | GIT_HASH | START_TIME | UPTIME | | ||
| +------+-----------------+-----------------+----------------------------------------+------------------------------------------+---------------------------+--------------+ | ||
| | tidb | 127.0.0.1:4000 | 127.0.0.1:10080 | 5.7.25-TiDB-v4.0.0-beta-195-gb5ea3232a | b5ea3232afa970f00db7a0fb13ed10857db1912e | 2020-03-02T16:27:28+08:00 | 4m18.845924s | | ||
| | pd | 127.0.0.1:2379 | 127.0.0.1:2379 | 4.1.0-alpha | 4b9bcbc1425c96848042b6d700eb63f84e72b338 | 2020-03-02T16:27:17+08:00 | 4m29.845928s | | ||
| | tikv | 127.0.0.1:20160 | 127.0.0.1:20180 | 4.1.0-alpha | 7c4202a1c8faf60eda659dfe0e64e31972488e78 | 2020-03-02T16:27:28+08:00 | 4m18.845929s | | ||
| +------+-----------------+-----------------+----------------------------------------+------------------------------------------+---------------------------+--------------+ | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| title: CLUSTER_LOAD | ||
| summary: 了解 TiDB 集群配置表 `CLUSTER_LOAD`。 | ||
| category: reference | ||
| --- | ||
|
|
||
| # CLUSTER_LOAD | ||
|
|
||
| 集群负载表 `CLUSTER_LOAD` 提供集群各个节点所在服务器的的当前负载信息。 | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| desc cluster_load; | ||
| ``` | ||
|
|
||
| ``` | ||
| +-------------+--------------+------+------+---------+-------+ | ||
| | Field | Type | Null | Key | Default | Extra | | ||
| +-------------+--------------+------+------+---------+-------+ | ||
| | TYPE | varchar(64) | YES | | NULL | | | ||
| | INSTANCE | varchar(64) | YES | | NULL | | | ||
| | DEVICE_TYPE | varchar(64) | YES | | NULL | | | ||
| | DEVICE_NAME | varchar(64) | YES | | NULL | | | ||
| | NAME | varchar(256) | YES | | NULL | | | ||
| | VALUE | varchar(128) | YES | | NULL | | | ||
| +-------------+--------------+------+------+---------+-------+ | ||
| ``` | ||
|
|
||
| 字段解释: | ||
|
|
||
| * `TYPE`:对应于节点信息表 `information_schema.cluster_info` 中的 `TYPE` 字段,可取值为 `tidb`,`pd` 或 `tikv`。 | ||
| * `INSTANCE`:对应于节点信息表 `information_schema.cluster_info` 中的 `STATUS_ADDRESS` 字段。 | ||
| * `DEVICE_TYPE`:硬件类型,目前可以查询的硬件类型有 `cpu`、`memory`、`disk` 和 `net`。 | ||
| * `DEVICE_NAME`:硬件名。对于不同的 `DEVICE_TYPE`,`DEVICE_NAME` 取值不同。 | ||
| * `cpu`:硬件名为 cpu。 | ||
| * `disk`:磁盘名。 | ||
| * `net`:网卡名。 | ||
| * `memory`:硬件名为 memory。 | ||
| * `NAME`:不同的负载类型。例如 cpu 有 `load1`/`load5`/`load15` 三个负载类型,分别表示 cpu 在 `1min`/`5min`/`15min` 内的平均负载。 | ||
| * `VALUE`:硬件负载的值,例如 cpu 在 `1min`/`5min`/`15min` 内的平均负载。 | ||
|
|
||
| 查询集群当前的 CPU 负载信息示例如下: | ||
|
|
||
| {{< copyable "sql" >}} | ||
|
|
||
| ```sql | ||
| select * from cluster_load where device_type='cpu' and device_name='cpu'; | ||
| ``` | ||
|
|
||
| ``` | ||
| +------+-----------------+-------------+-------------+--------+---------------+ | ||
| | TYPE | INSTANCE | DEVICE_TYPE | DEVICE_NAME | NAME | VALUE | | ||
| +------+-----------------+-------------+-------------+--------+---------------+ | ||
| | tidb | 127.0.0.1:10080 | cpu | cpu | load1 | 1.94 | | ||
| | tidb | 127.0.0.1:10080 | cpu | cpu | load5 | 2.16 | | ||
| | tidb | 127.0.0.1:10080 | cpu | cpu | load15 | 2.24 | | ||
| | pd | 127.0.0.1:2379 | cpu | cpu | load1 | 1.94 | | ||
| | pd | 127.0.0.1:2379 | cpu | cpu | load5 | 2.16 | | ||
| | pd | 127.0.0.1:2379 | cpu | cpu | load15 | 2.24 | | ||
| | tikv | 127.0.0.1:20160 | cpu | cpu | load1 | 1.94287109375 | | ||
| | tikv | 127.0.0.1:20160 | cpu | cpu | load5 | 2.15576171875 | | ||
| | tikv | 127.0.0.1:20160 | cpu | cpu | load15 | 2.2421875 | | ||
| +------+-----------------+-------------+-------------+--------+---------------+ | ||
| ``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.