-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
update tikv-ctl doc #3254
update tikv-ctl doc #3254
Changes from 1 commit
bc6fddc
23f5b52
ff830b6
92eaed3
3f61763
fcbf433
f95afcf
c65528c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Signed-off-by: qupeng <qupeng@pingcap.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -8,7 +8,7 @@ aliases: ['/docs-cn/dev/reference/tools/tikv-control/'] | |||||||||
|
||||||||||
TiKV Control(以下简称 tikv-ctl)是 TiKV 的命令行工具,用于管理 TiKV 集群。 | ||||||||||
|
||||||||||
编译 TiKV 的同时也会编译 tikv-ctl 命令。如果通过 Ansible 部署集群,则对应的 `tidb-ansible/resources/bin` 目录下会存在 `tikv-ctl` 二进制文件。如果使用二进制文件部署集群,bin 目录下会包含 `tikv-ctl` 文件及 `tidb-server`、`pd-server`、以及 `tikv-server` 等其他文件。 | ||||||||||
编译 TiKV 的同时也会编译 tikv-ctl 命令。如果通过 Ansible 部署集群,则对应的 `tidb-ansible/resources/bin` 目录下会存在 `tikv-ctl` 二进制文件。 | ||||||||||
|
||||||||||
## 通用参数 | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 目前 这几个 ctl 工具,都可以 tiup ctl 调用,举个例子说明下吧。 |
||||||||||
|
||||||||||
|
@@ -192,16 +192,20 @@ success! | |||||||||
|
||||||||||
`compact-cluster` 命令可以对整个 TiKV 集群进行手动 compact。该命令参数的含义和使用与 `compact` 命令一样。 | ||||||||||
|
||||||||||
### 设置一个 Region 为 tombstone | ||||||||||
### 设置一个 Region 副本为 tombstone | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tombstone 状态? |
||||||||||
|
||||||||||
`tombstone` 命令常用于没有开启 sync-log,因为机器掉电导致 Raft 状态机丢失部分写入的情况。它可以在一个 TiKV 实例上将一些 Region 设置为 Tombstone 状态,从而在重启时跳过这些 Region。这些 Region 应该在其他 TiKV 上有足够多的健康的副本以便能够继续通过 Raft 机制进行读写。 | ||||||||||
`tombstone` 命令常用于没有开启 sync-log,因为机器掉电导致 Raft 状态机丢失部分写入的情况。它可以在一个 TiKV 实例上将一些 Region 的副本设置为 Tombstone 状态,从而在重启时跳过这些 Region,避免因为这些 Region 的副本的 Raft 状态机损坏而无法启动服务。这些 Region 应该在其他 TiKV 上有足够多的健康的副本以便能够继续通过 Raft 机制进行读写。 | ||||||||||
|
||||||||||
一般情况下,我们可以先在 PD 上将 Region 的副本通过 remove-peer 命令删除掉: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
{{< copyable "" >}} | ||||||||||
|
||||||||||
```shell | ||||||||||
pd-ctl>> operator add remove-peer <region_id> <store_id> | ||||||||||
``` | ||||||||||
|
||||||||||
然后再用 tikv-ctl 在那个 TiKV 实例上将 Region 的副本标记为 tombstone 以便跳过启动时对他的健康检查: | ||||||||||
|
||||||||||
{{< copyable "shell-regular" >}} | ||||||||||
|
||||||||||
```shell | ||||||||||
|
@@ -212,10 +216,21 @@ tikv-ctl --db /path/to/tikv/db tombstone -p 127.0.0.1:2379 -r <region_id> | |||||||||
success! | ||||||||||
``` | ||||||||||
|
||||||||||
但是有些情况下,当不能方便地从 PD 上移除这个副本时,可以指定 tikv-ctl 的 --force 选项来强制设置它为 tombstone: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
```shell | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
tikv-ctl --db /path/to/tikv/db tombstone -p 127.0.0.1:2379 -r <region_id>,<region_id> --force | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why there are two region_id here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's expected. Just show multiple region id can be specified. |
||||||||||
``` | ||||||||||
|
||||||||||
``` | ||||||||||
success! | ||||||||||
``` | ||||||||||
|
||||||||||
|
||||||||||
> **注意:** | ||||||||||
> | ||||||||||
> - **该命令只支持本地模式** | ||||||||||
> - `-p` 选项的参数指定 PD 的 endpoints,无需 `http` 前缀。指定 PD 的 endpoints 是为了询问 PD 是否可以安全切换至 Tombstone 状态。因此,在将 PD 置为 Tombstone 之前往往还需要在 `pd-ctl` 中把该 Region 在机器上的对应 Peer 拿掉。 | ||||||||||
> - `-p` 选项的参数指定 PD 的 endpoints,无需 `http` 前缀。指定 PD 的 endpoints 是为了询问 PD 是否可以安全切换至 Tombstone 状态。 | ||||||||||
|
||||||||||
### 向 TiKV 发出 consistency-check 请求 | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用户不太关心 tikv-ctl 是如何产生的,只需要告诉他在什么地方就可以了,ansible 这部分需要改成 tiup