forked from pingcap/docs
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add 3 monitoring documents (pingcap#2791)
* add 2 monitoring documents * Update TOC.md * align pingcap#3195 * fix ci * address comments from lilian Co-authored-by: Lilian Lee <lilin@pingcap.com> * remove extra information Co-authored-by: Lilian Lee <lilin@pingcap.com>
- Loading branch information
Showing
10 changed files
with
126 additions
and
92 deletions.
There are no files selected for viewing
This file contains 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 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains 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 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 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,81 @@ | ||
--- | ||
title: TiDB Monitoring API | ||
summary: Learn the API of TiDB monitoring services. | ||
category: how-to | ||
--- | ||
|
||
# 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 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 | ||
|
||
The state interface monitors the basic information of a specific component in the TiDB cluster. It can also act as the monitor interface for Keepalive messages. In addition, the state interface for the Placement Driver (PD) can get the details of the entire TiKV cluster. | ||
|
||
### TiDB server | ||
|
||
- 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. | ||
|
||
```bash | ||
curl http://127.0.0.1:10080/status | ||
{ | ||
connections: 0, # The current number of clients connected to the TiDB server. | ||
version: "5.7.25-TiDB-v3.0.0-beta-250-g778c3f4a5", # The TiDB version number. | ||
git_hash: "778c3f4a5a716880bcd1d71b257c8165685f0d70" # The Git Hash of the current TiDB code. | ||
} | ||
``` | ||
|
||
### PD server | ||
|
||
- PD API address: `http://${host}:${port}/pd/api/v1/${api_name}` | ||
- Default port: `2379` | ||
- Details about API names: see [PD API doc](https://download.pingcap.com/pd-api-v1.html) | ||
|
||
The PD interface provides the state of all the TiKV servers and the information about load balancing. See the following example for the information about a single-node TiKV cluster: | ||
|
||
```bash | ||
curl http://127.0.0.1:2379/pd/api/v1/stores | ||
{ | ||
"count": 1, # The number of TiKV nodes. | ||
"stores": [ # The list of TiKV nodes. | ||
# The details about the single TiKV node. | ||
{ | ||
"store": { | ||
"id": 1, | ||
"address": "127.0.0.1:20160", | ||
"version": "3.0.0-beta", | ||
"state_name": "Up" | ||
}, | ||
"status": { | ||
"capacity": "20 GiB", # The total capacity. | ||
"available": "16 GiB", # The available capacity. | ||
"leader_count": 17, | ||
"leader_weight": 1, | ||
"leader_score": 17, | ||
"leader_size": 17, | ||
"region_count": 17, | ||
"region_weight": 1, | ||
"region_score": 17, | ||
"region_size": 17, | ||
"start_ts": "2019-03-21T14:09:32+08:00", # The starting timestamp. | ||
"last_heartbeat_ts": "2019-03-21T14:14:22.961171958+08:00", # The timestamp of the last heartbeat. | ||
"uptime": "4m50.961171958s" | ||
} | ||
} | ||
] | ||
``` | ||
## Use the metrics interface | ||
The metrics interface monitors the state and performance of the entire TiDB cluster. | ||
- If you use TiDB Ansible to deploy the TiDB cluster, the monitoring system (Prometheus and Grafana) is deployed at the same time. | ||
- If you use other deployment ways, [deploy Prometheus and Grafana](/deploy-monitoring-services.md) before using this interface. | ||
After Prometheus and Grafana are successfully deployed, [configure Grafana](/deploy-monitoring-services.md#configure-grafana). |
This file contains 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