# Four Letter Words （四字命令）

* zk可以通过它自身提供的简写命令来和服务器进行交互
* 需要使用nc命令，安装`yun install nc`
* 使用 `echo [commond] | nc [ip] [port]`

官方地址：<http://zookeeper.apache.org/doc/r3.4.13/zookeeperAdmin.html#sc_zkCommands>

命令：

* \[stat] 查看zk的状态信息，以及是否mode

```
$ echo stat | grep 192.168.1.110 2181
$ echo stat | grep localhost 2181
```

* \[ruock] 查看当前zkserver是否启动，返回imok

> are you ok ? i am ok

```
$ echo ruock | grep localhost 2181
imok
```

* \[dump] 列出未经处理的会话和临时节点

```
$ echo dump | grep localhost 2181
```

* \[conf]  查看服务器配置

```
$ echo conf | grep localhost 2181
```

* \[cons]  展示连接到服务器的客户端信息

```
$ echo cons | grep localhost 2181
```

* \[envi]  环境变量

```
$ echo envi | grep localhost 2181
```

* \[mntr]  监控zk健康信息

```
$ echo mntr | grep localhost 2181
```

* \[wchs]  展示watch的信息

```
$ echo wchs | grep localhost 2181
```

* \[wchc]与\[wchp] session 与watch 及 path与watch信息。

wchc ，wchp，需要加入白名单才可以执行。

参考：

[zookeeper权限acl与四字命令](http://blog.51cto.com/zero01/2106801)

[ZooKeeper: 简介, 配置及运维指南](https://www.cnblogs.com/neooelric/p/9230967.html)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaoxiami.gitbook.io/zookeeper/zookeeper-cao-zuo-ming-ling/four-letter-words-ff08-si-zi-ming-ling-ff09.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
