Skip to content

Commit

Permalink
docs: update the TiKV store status description (#8723) (#8730)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Mar 24, 2022
1 parent ac7e3c4 commit bcc91c6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
7 changes: 5 additions & 2 deletions faq/deploy-and-maintain-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ TiDB 支持部署和运行在 Intel x86-64 架构的 64 位通用硬件服务器

慢查询日志默认记录到 tidb.log 中,如果希望生成单独的慢查询日志文件,修改 inventory.ini 配置文件的参数 `enable_slow_query_log` 为 True。

如上配置修改之后,需要执行 `ansible-playbook rolling_update.yml --tags=tidb`,对 tidb-server 实例进行滚动升级,升级完成后,tidb-server 将在 `tidb_slow_query.log`
文件中记录慢查询日志。
如上配置修改之后,需要执行 `ansible-playbook rolling_update.yml --tags=tidb`,对 tidb-server 实例进行滚动升级,升级完成后,tidb-server 将在 `tidb_slow_query.log` 文件中记录慢查询日志。

2)如果出现了慢查询,可以从 Grafana 监控定位到出现慢查询的 tidb-server 以及时间点,然后在对应节点查找日志中记录的 SQL 信息。

Expand Down Expand Up @@ -277,6 +276,10 @@ PD 启动参数中的 `--initial-cluster` 包含了某个不属于该集群的
Client 连接只能通过 TiDB 访问集群,TiDB 负责连接 PD 与 TiKV,PD 与 TiKV 对 Client 透明。当 TiDB 连接任意一台 PD 的时候,PD 会告知 TiDB 当前的 leader 是谁,如果此台 PD 不是 leader,TiDB 将会重新连接至 leader PD。
#### TiKV 节点 (Store) 各状态 (Up, Disconnect, Offline, Down, Tombstone) 之间的关系是什么?
使用 `pd-ctl` 可以查看 TiKV 节点的状态信息。如需查看各个状态之间的关系,请参考 [TiKV Store 状态之间的关系](/tidb-scheduling.md#信息收集)。
#### PD 参数中 leader-schedule-limit 和 region-schedule-limit 调度有什么区别?
- leader-schedule-limit 调度是用来均衡不同 TiKV 的 leader 数,影响处理查询的负载。
Expand Down
Binary file added media/tikv-store-status-relationship.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion pd-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,10 @@ Encoding 格式示例:
>> store remove-tombstone // 删除所有 tombstone 状态的 store
```

`store limit` 的用法见 [Store Limit](/configure-store-limit.md)。
> **注意:**
>
> * `store limit` 命令原有的 `region-add``region-remove` 子命令已废弃,请使用 `add-peer``remove-peer` 来替代。
> * 使用 `pd-ctl` 可以查看 TiKV 节点的状态信息,即 Up,Disconnect,Offline,Down,或 Tombstone。如需查看各个状态之间的关系,请参考 [TiKV Store 状态之间的关系](/tidb-scheduling.md#信息收集)。

### `log [fatal | error | warn | info | debug]`

Expand Down
10 changes: 10 additions & 0 deletions tidb-scheduling.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ TiKV 节点(Store)与 PD 之间存在心跳包,一方面 PD 通过心跳
* 是否过载
* labels 标签信息(标签是具备层级关系的一系列 Tag,能够[感知拓扑信息](/schedule-replicas-by-topology-labels.md)

通过使用 `pd-ctl` 可以查看到 TiKV Store 的状态信息。TiKV Store 的状态具体分为 Up,Disconnect,Offline,Down,Tombstone。各状态的关系如下:

+ **Up**:表示当前的 TiKV Store 处于提供服务的状态。
+ **Disconnect**:当 PD 和 TiKV Store 的心跳信息丢失超过 20 秒后,该 Store 的状态会变为 Disconnect 状态,当时间超过 `max-store-down-time` 指定的时间后,该 Store 会变为 Down 状态。
+ **Down**:表示该 TiKV Store 与集群失去连接的时间已经超过了 `max-store-down-time` 指定的时间,默认 30 分钟。超过该时间后,对应的 Store 会变为 Down,并且开始在存活的 Store 上补足各个 Region 的副本。
+ **Offline**:当对某个 TiKV Store 通过 PD Control 进行手动下线操作,该 Store 会变为 Offline 状态。该状态只是 Store 下线的中间状态,处于该状态的 Store 会将其上的所有 Region 搬离至其它满足搬迁条件的 Up 状态 Store。当该 Store 的 `leader_count``region_count` (在 PD Control 中获取) 均显示为 0 后,该 Store 会由 Offline 状态变为 Tombstone 状态。在 Offline 状态下,禁止关闭该 Store 服务以及其所在的物理服务器。下线过程中,如果集群里不存在满足搬迁条件的其它目标 Store(例如没有足够的 Store 能够继续满足集群的副本数量要求),该 Store 将一直处于 Offline 状态。
+ **Tombstone**:表示该 TiKV Store 已处于完全下线状态,可以使用 `remove-tombstone` 接口安全地清理该状态的 TiKV。

![TiKV store status relationship](/media/tikv-store-status-relationship.png)

**每个 Raft Group 的 Leader 会定期向 PD 汇报 Region 的状态信息**

每个 Raft Group 的 Leader 和 PD 之间存在心跳包,用于汇报这个[Region 的状态](https://github.com/pingcap/kvproto/blob/release-4.0/proto/pdpb.proto#L284),主要包括下面几点信息:
Expand Down

0 comments on commit bcc91c6

Please sign in to comment.