This is an automated email from the ASF dual-hosted git repository.
spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 3c94f21df docs: update node-status doc (#7397)
3c94f21df is described below
commit 3c94f21df2ebbffa7483f6828a33bd985f758ac3
Author: HanFei <[email protected]>
AuthorDate: Fri Jul 8 11:37:43 2022 +0800
docs: update node-status doc (#7397)
---
docs/en/latest/plugins/node-status.md | 22 ++--------
docs/zh/latest/plugins/node-status.md | 76 +++++++++++++++++------------------
2 files changed, 39 insertions(+), 59 deletions(-)
diff --git a/docs/en/latest/plugins/node-status.md
b/docs/en/latest/plugins/node-status.md
index ad0c681cc..353b45587 100644
--- a/docs/en/latest/plugins/node-status.md
+++ b/docs/en/latest/plugins/node-status.md
@@ -71,7 +71,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/ns -H
'X-API-KEY: edd1c9f034335f1
Once you have configured the Plugin, you can make a request to the
`apisix/status` endpoint to get the status:
```shell
-curl localhost:9080/apisix/status -i
+curl http://127.0.0.1:9080/apisix/status -i
```
```shell
@@ -103,7 +103,7 @@ The parameters in the response are described below:
To remove the Plugin, you can remove it from your configuration file
(`conf/config.yaml`):
-```
+```yaml title="conf/config.yaml"
plugins:
- example-plugin
- limit-req
@@ -112,24 +112,8 @@ plugins:
......
```
-To disable the `node-status` Plugin on a Route, you can delete the
corresponding JSON configuration from the Plugin configuration. APISIX will
automatically reload and you do not have to restart for this to take effect.
-
-```sh
-curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
-{
- "uri": "/route1",
- "upstream": {
- "type": "roundrobin",
- "nodes": {
- "192.168.1.100:80": 1
- }
- },
- "plugins": {}
-}'
-```
-
You can also remove the Route on `/apisix/status`:
-```sh
+```shell
curl http://127.0.0.1:9080/apisix/admin/routes/ns -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X DELETE
```
diff --git a/docs/zh/latest/plugins/node-status.md
b/docs/zh/latest/plugins/node-status.md
index b9f131791..1c20f1251 100644
--- a/docs/zh/latest/plugins/node-status.md
+++ b/docs/zh/latest/plugins/node-status.md
@@ -1,5 +1,11 @@
---
title: node-status
+keywords:
+ - Apache APISIX
+ - API 网关
+ - 插件
+ - Node status
+description: 本文介绍了 API 网关 Apache APISIX node-status 插件的相关信息。
---
<!--
@@ -23,7 +29,7 @@ title: node-status
## 描述
-`node-status` 是 `APISIX` 的请求状态查询插件,返回基本的状态信息。
+`node-status` 插件可用于通过暴露的 API 查询 APISIX 的请求状态,并返回基本的状态信息。
## 插件属性
@@ -31,15 +37,14 @@ title: node-status
## 插件接口
-插件增加接口 `/apisix/status`,需要通过
[public-api](../../../en/latest/plugins/public-api.md) 插件来暴露它。
+该插件将会增加 `/apisix/status` 的接口用来暴露 APISIX 的状态,你需要通过 [public-api](public-api.md)
插件来暴露该接口。
## 启用插件
-1. 配置文件 `conf/config.yaml` 的 plugin list 中配置 `node-status`
+`node-status` 插件默认为禁用状态,如果你需要使用该插件,请在配置文件 `./conf/config.yaml` 中启用它:
-```
-plugins: # plugin list
- - example-plugin
+``` yaml title="./conf/config.yaml"
+plugins:
- limit-req
- node-status
- jwt-auth
@@ -47,10 +52,10 @@ plugins: # plugin list
......
```
-2. 为状态 API 配置路由,它将使用 [public-api](../../../en/latest/plugins/public-api.md) 插件。
+你需要为 `/apisix/status` API 配置路由,并使用 [public-api](public-api.md) 插件暴露它。
```shell
-$ curl http://127.0.0.1:9080/apisix/admin/routes/ns -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9080/apisix/admin/routes/ns -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/apisix/status",
"plugins": {
@@ -61,10 +66,13 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/ns -H
'X-API-KEY: edd1c9f034335
## 测试插件
-1. 发送请求
+完成上述配置后,你可以通过以下命令向 `/apisix/status` 发送请求以获取状态信息。
-```sh
-$ curl localhost:9080/apisix/status -i
+```shell
+curl http://127.0.0.1:9080/apisix/status -i
+```
+
+```shell
HTTP/1.1 200 OK
Date: Tue, 03 Nov 2020 11:12:55 GMT
Content-Type: text/plain; charset=utf-8
@@ -75,45 +83,33 @@ Server: APISIX web server
{"status":{"total":"23","waiting":"0","accepted":"22","writing":"1","handled":"22","active":"1","reading":"0"},"id":"6790a064-8f61-44ba-a6d3-5df42f2b1bb3"}
```
-2. 参数说明
+返回结果中的参数释义如下:
-| 参数 | 说明 |
-| ------------ | -------------------------------------------- |
-| status | 状态信息 |
-| total | 客户端请求总数 |
-| waiting | 当前等待客户端请求的空闲连接数 |
-| accepted | 已经接受的客户端连接总数 |
-| writing | 当前正在写给客户端响应的连接数 |
-| handled | 已经处理的连接总数,通常等于 accepted |
-| active | 当前活跃的客户端连接数 |
-| reading | 当前正在读取请求头的连接数 |
-| id | APISIX uid 信息,保存在 apisix/conf/apisix.uid |
+| 参数 | 说明
|
+| ------------ |
---------------------------------------------------------------------- |
+| status | APISIX 的状态信息。
|
+| total | 客户端请求总数。
|
+| waiting | 当前等待客户端请求的空闲连接数。 |
+| accepted | 当前已经接受的客户端连接总数。 |
+| writing | 当前正在写给客户端响应的连接数。 |
+| handled | 当前已经处理的连接总数,除非达到其他资源的限制,否则此值与 `accepted` 相同。 |
+| active | 当前活跃的客户端连接数。 |
+| reading | 当前正在读取请求头的连接数。 |
+| id | APISIX UID 信息,保存在 `./conf/apisix.uid` 文件中。 |
## 禁用插件
-1. 配置文件 `apisix/conf/config.yaml` 的 plugin list 中删除 `node-status`
+如果你不再需要该插件,可以从配置文件 (`./conf/config.yaml`) 中删除它:
-```
-plugins: # plugin list
- - example-plugin
+``` yaml title="conf/config.yaml"
- limit-req
- jwt-auth
- zipkin
......
```
-2. 删除 route 中的 `node-status` 插件信息
+你也可以移除暴露 `/apisix/status` 接口的路由。
-```sh
-$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
-{
- "uri": "/route1",
- "upstream": {
- "type": "roundrobin",
- "nodes": {
- "192.168.1.100:80": 1
- }
- },
- "plugins": {}
-}'
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/ns -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X DELETE
```