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

doc:add config for hot region history and add command for pd ctl #7163

Merged
merged 15 commits into from
Jan 11, 2022
14 changes: 14 additions & 0 deletions pd-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,20 @@ PD 配置文件比命令行参数支持更多的选项。你可以在 [conf/conf
+ 是否使用 Joint Consensus 进行副本调度。关闭该特性时,PD 将采用一次调度一个副本的方式进行调度。
+ 默认值:true

### `hot-regions-write-interval`
qidi1 marked this conversation as resolved.
Show resolved Hide resolved

* 设置 PD 存储 Hot Region 信息时间间隔。
* 默认值:10m

> 注意:
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
>
> Hot Region 的信息一般 3 分钟更新一次。如果设置时间间隔小于 3 分钟,中间部分的更新可能没有意义。

### `hot-regions-reserved-days`
qidi1 marked this conversation as resolved.
Show resolved Hide resolved

* 设置 PD 保留的 Hot Region 信息的最长时间。单位为天。
* 默认值: 7

## replication

副本相关的配置项。
Expand Down
79 changes: 75 additions & 4 deletions pd-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ PD Control 是 PD 的命令行工具,用于获取集群状态信息和调整

如需下载最新版本的 `pd-ctl`,直接下载 TiDB 安装包即可,因为 `pd-ctl` 包含在 TiDB 安装包中。

| 安装包 | 操作系统 | 架构 | SHA256 校验和 |
|:---|:---|:---|:---|
| `https://download.pingcap.org/tidb-{version}-linux-amd64.tar.gz` (pd-ctl) | Linux | amd64 | `https://download.pingcap.org/tidb-{version}-linux-amd64.sha256` |
| 安装包 | 操作系统 | 架构 | SHA256 校验和 |
| :------------------------------------------------------------------------ | :------- | :---- | :--------------------------------------------------------------- |
| `https://download.pingcap.org/tidb-{version}-linux-amd64.tar.gz` (pd-ctl) | Linux | amd64 | `https://download.pingcap.org/tidb-{version}-linux-amd64.sha256` |

> **注意:**
>
Expand Down Expand Up @@ -483,7 +483,7 @@ export PD_ADDR=http://127.0.0.1:2379 &&
]
```

### `hot [read | write | store]`
### `hot [read | write | store| history <start_time> <end_time> [<key> <value>]]`

用于显示集群热点信息。示例如下。

Expand Down Expand Up @@ -511,6 +511,77 @@ export PD_ADDR=http://127.0.0.1:2379 &&
>> hot store
```

显示历史读写热点信息:

{{< copyable "" >}}

```
>> hot history startTime endTime [ <name> <value> ]
```

例如查询时间 `1629294000000` 到 `1631980800000` (毫秒)之间的历史热点 Region 信息:

{{< copyable "" >}}

```
>> hot history 1629294000000 1631980800000

qidi1 marked this conversation as resolved.
Show resolved Hide resolved
```

```
{
"history_hot_region": [
{
"update_time": 1630864801948,
"region_id": 103,
"peer_id": 1369002,
"store_id": 3,
"is_leader": true,
"is_learner": false,
"hot_region_type": "read",
"hot_degree": 152,
"flow_bytes": 0,
"key_rate": 0,
"query_rate": 305,
"start_key": "7480000000000000FF5300000000000000F8",
"end_key": "7480000000000000FF5600000000000000F8"
},
...
]
}
```

对于参数的值为数组的请用 x, y, ... 形式进行参数值的设置,所有支持的参数如下所示:
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

{{< copyable "" >}}

```
>> hot history 1629294000000 1631980800000 hot_region_type read region_id 1,2,3 store_id 1,2,3 peer_id 1,2,3 is_leader true is_learner true
```

```
{
"history_hot_region": [
{
"update_time": 1630864801948,
"region_id": 103,
"peer_id": 1369002,
"store_id": 3,
"is_leader": true,
"is_learner": false,
"hot_region_type": "read",
"hot_degree": 152,
"flow_bytes": 0,
"key_rate": 0,
"query_rate": 305,
"start_key": "7480000000000000FF5300000000000000F8",
"end_key": "7480000000000000FF5600000000000000F8"
},
...
]
}
```

### `label [store <name> <value>]`

用于显示集群标签信息。示例如下。
Expand Down