From 5ad4aba2c59b7a69ef12dd782d3937c1724b65e6 Mon Sep 17 00:00:00 2001 From: en-jin19 Date: Thu, 5 Aug 2021 10:42:40 +0200 Subject: [PATCH 1/2] TiDB monitoring: dd table storage info status api --- tidb-monitoring-api.md | 49 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/tidb-monitoring-api.md b/tidb-monitoring-api.md index f5e6313b60b29..3b9319b6d4f32 100644 --- a/tidb-monitoring-api.md +++ b/tidb-monitoring-api.md @@ -8,7 +8,8 @@ aliases: ['/docs/dev/tidb-monitoring-api/'] You can use the following two types of interfaces to monitor the TiDB cluster state: -- [The state interface](#use-the-state-interface): this interface uses the HTTP interface to get the component information. +- [The state interface](#running-status): this interface uses the HTTP interface to get the component information. +- [Storage information](#storage-information): it uses the HTTP interface to get the storage information from data tables. - [The metrics interface](#use-the-metrics-interface): this interface uses Prometheus to record the detailed information of the various operations in components and views these metrics using Grafana. ## Use the state interface @@ -20,7 +21,9 @@ The state interface monitors the basic information of a specific component in th - TiDB API address: `http://${host}:${port}` - Default port: `10080` -The following example uses `http://${host}:${port}/status` to get the current state of the TiDB server and to determine whether the server is alive. The result is returned in JSON format. +### Running status + +The following example uses `http://${host}:${port}/status` to get the current state of the TiDB server and to determine whether the server is alive. The result is returned in **JSON** format. ```bash curl http://127.0.0.1:10080/status @@ -31,6 +34,48 @@ curl http://127.0.0.1:10080/status } ``` +#### Storage information + +The following example uses `http://${host}:${port}/schema_storage/${db}/${table}` to get the storage information from the specific data tables. The result is returned in **JSON** format. + +{{< copyable "shell-regular" >}} + +```bash +curl http://127.0.0.1:10080/schema_storage/mysql/stats_histograms +``` + +``` +{ + "table_schema": "mysql", + "table_name": "stats_histograms", + "table_rows": 0, + "avg_row_length": 0, + "data_length": 0, + "max_data_length": 0, + "index_length": 0, + "data_free": 0 +} +``` + +```bash +curl http://127.0.0.1:10080/schema_storage/test +``` + +``` +[ + { + "table_schema": "test", + "table_name": "test", + "table_rows": 0, + "avg_row_length": 0, + "data_length": 0, + "max_data_length": 0, + "index_length": 0, + "data_free": 0 + } +] +``` + ### PD server - PD API address: `http://${host}:${port}/pd/api/v1/${api_name}` From 92ca050eb40aa1535d6f5bae22010dd30c994eaa Mon Sep 17 00:00:00 2001 From: en-jin19 Date: Thu, 5 Aug 2021 12:07:19 +0200 Subject: [PATCH 2/2] revise the translation --- tidb-monitoring-api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tidb-monitoring-api.md b/tidb-monitoring-api.md index 3b9319b6d4f32..13dc89b2f47d7 100644 --- a/tidb-monitoring-api.md +++ b/tidb-monitoring-api.md @@ -9,7 +9,7 @@ aliases: ['/docs/dev/tidb-monitoring-api/'] You can use the following two types of interfaces to monitor the TiDB cluster state: - [The state interface](#running-status): this interface uses the HTTP interface to get the component information. -- [Storage information](#storage-information): it uses the HTTP interface to get the storage information from data tables. +- [Storage information](#storage-information): this interface uses the HTTP interface to get the storage information of data tables. - [The metrics interface](#use-the-metrics-interface): this interface uses Prometheus to record the detailed information of the various operations in components and views these metrics using Grafana. ## Use the state interface @@ -36,7 +36,7 @@ curl http://127.0.0.1:10080/status #### Storage information -The following example uses `http://${host}:${port}/schema_storage/${db}/${table}` to get the storage information from the specific data tables. The result is returned in **JSON** format. +The following example uses `http://${host}:${port}/schema_storage/${db}/${table}` to get the storage information of the specific data table. The result is returned in **JSON** format. {{< copyable "shell-regular" >}}