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

Document tikv-ctl #691

Merged
merged 10 commits into from
May 8, 2018
Merged

Document tikv-ctl #691

merged 10 commits into from
May 8, 2018

Conversation

hicqu
Copy link
Contributor

@hicqu hicqu commented Apr 24, 2018

This PR document tikv-ctl.

@hicqu hicqu changed the title [WIP] Document tikv-ctl Document tikv-ctl Apr 24, 2018
@QueenyJin
Copy link
Contributor

QueenyJin commented Apr 24, 2018

@lilin90 li PTAL

Copy link
Member

@lilin90 lilin90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update format and wording. Thanks!

# TiKV Control 使用说明

TiKV Control (tikv-ctl) 是随 TiKV 附带的一个简单的管理工具,以下简称 tikv-ctl。
在编译 tikv 时,tikv-ctl 命令也会同时被编译出来,而通过 ansible 部署的集群,在
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • tikv -> TiKV
  • ansible -> Ansible

AAFF
```

注意在命令行上指定 `escaped` 形式的 key 时,需要用双引号引起来,否则 bash 会将
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the "Note" format as below (> ****):

注意: 在命令行上指定 escaped 形式的 key 时,需要用双引号引起来,否则 bash 会将反斜杠吃掉,从而得到错误的结果。


# TiKV Control 使用说明

TiKV Control (tikv-ctl) 是随 TiKV 附带的一个简单的管理工具,以下简称 tikv-ctl。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the text, usually, we use the default length of a line, because manually changing a line makes it inconvenient for format review (such as whitespaces). If possible, would you please update them? You can refer to other .md files.

### 查看 Raft 状态机的信息
`raft` 子命令可以查看 Raft 状态机在某一时刻的状态,包括 **RegionLocalState**,
**RaftLocalState**, **RegionApplyState** 三个结构体,及某一条 log 对应的 Entries。
它有 `region` 和 `log` 两个子命令分别做这两件事。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the three lines above, pls delete the extra whitespaces between Chinese punctuation and English/special characters.

打印某个 key 的值需要用到 `print` 命令。示例从略。

### 手动 compact 数据
`compact` 命令可以对 tikv 进行手动 compact。如果指定 `-from` 和 `--to` 选项,那么它们的参数
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tikv -> TiKV


### 手动 compact 数据
`compact` 命令可以对 tikv 进行手动 compact。如果指定 `-from` 和 `--to` 选项,那么它们的参数
也是 escaped raw key 形式的。`--db` 参数可以指定要 compact 的 Rocksdb,有 `kv` 和 `raft`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rocksdb -> RocksDB

success!
```

这个命令只支持本地模式。注意,`--pd/-p` 选项的参数指定 PD 的 endponits,他是没有 `http` 前缀的。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add the "Note" format
  • endponits -> endpoints
  • 他 -> 它

### 打印 Raft 状态机出错的 Region
前面 tombstone 命令可以将 Raft 状态机出错的 Region 设置为 Tombstone 状态,避免 TiKV 启动
时对它们进行检查。在运行那个命令之前,`bad-regions` 命令可以找出这些出错了的 Region,以便
我们可以多个工具组合起来进行自动话的处理。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "我们可以" -> "将"
  • "自动话" -> "自动化"

```

命令执行成功会打印上面的信息,否则会打印出有错误的 Region 列表。目前可以检出的错误包括
last index、commit index 和 apply index 之间的不匹配,以及 raft log 的丢失。其他一些情况,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raft -> Raft?

Copy link
Member

@lilin90 lilin90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lilin90
Copy link
Member

lilin90 commented May 3, 2018

@siddontang PTAL

Copy link
Contributor

@CaitinChen CaitinChen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CaitinChen CaitinChen merged commit 6875b15 into pingcap:master May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants