怎么看telnet 连接zookeeper成功了
时间: 2023-12-20 16:05:28 浏览: 34
当 Telnet 连接成功后,你会看到类似以下的输出:
```
Trying 192.168.1.100...
Connected to 192.168.1.100.
Escape character is '^]'.
```
其中,`Trying <zookeeper_host>...` 表示正在尝试连接 Zookeeper 服务器,`Connected to <zookeeper_host>.` 表示连接成功,`Escape character is '^]'` 表示可以使用 Ctrl+] 快捷键来退出 Telnet 客户端。
连接成功后,你可以输入 Zookeeper 命令行客户端的命令来与 Zookeeper 进行交互。如果你输入的命令无误,Zookeeper 服务器会返回相应的结果。例如,你可以输入 `ruok` 命令来检查 Zookeeper 服务器是否处于正常运行状态,如果 Zookeeper 服务器正常运行,它会返回 `imok`。
相关问题
telnet 连接zookeeper
你可以使用以下命令使用 Telnet 连接 Zookeeper:
```
telnet <zookeeper_host> <zookeeper_port>
```
其中 `<zookeeper_host>` 是 Zookeeper 服务器的 IP 地址或主机名,`<zookeeper_port>` 是 Zookeeper 服务器监听的端口号,默认情况下为 2181。
例如,如果 Zookeeper 服务器的 IP 地址为 192.168.1.100,端口号为 2181,则可以使用以下命令连接 Zookeeper:
```
telnet 192.168.1.100 2181
```
连接成功后,你可以使用 Zookeeper 的命令行客户端来与 Zookeeper 进行交互。
telnet 连接zookeeper 并查询注册的服务
要查询注册在 Zookeeper 上的服务,你需要使用 Zookeeper 的命令行客户端来执行相应的命令。以下是在 Telnet 中查询 Zookeeper 中注册的服务的步骤:
1. 使用 Telnet 连接 Zookeeper:
```
telnet <zookeeper_host> <zookeeper_port>
```
2. 连接成功后,进入 Zookeeper 的命令行客户端:
```
ls /
```
3. 执行 `ls /` 命令可以列出 Zookeeper 根节点 `/` 下的所有子节点,其中每个子节点的名称都是一个注册的服务。例如,如果你在 Zookeeper 上注册了一个名为 `my-service` 的服务,则可以在 Telnet 中执行以下命令来查看该服务的详细信息:
```
get /my-service
```
4. 如果该服务存在,Zookeeper 服务器会返回该服务的详细信息。你可以根据服务的具体实现来解析这些信息。如果该服务不存在,Zookeeper 服务器会返回 `Node does not exist`。
注意,要查询 Zookeeper 中注册的服务,你需要先知道服务的路径。在大多数情况下,服务的路径都是由服务名和版本号组成的。例如,如果你注册了一个名为 `my-service` 的版本为 `v1` 的服务,那么它的路径可能是 `/services/my-service/v1`。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)