Skip to content

Commit

Permalink
docs: update limit count plugin doc (#8196)
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyDluffy6017 authored Oct 31, 2022
1 parent ff3c545 commit ad1f122
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion docs/en/latest/plugins/limit-count.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ curl -i http://127.0.0.1:9180/apisix/admin/services/1 \
}'
```

Now every request will share the same count limitation regardless of their remote address.
The above configuration means that when the `group` attribute of the `limit-count` plugin is configured to `services_1#1640140620` for multiple routes, requests to those routes will share the same counter, even if the requests come from different IP addresses.

:::note

The configuration of `limit-count` in the same `group` must be consistent. If you want to change the configuration, you need to update the value of the corresponding `group` at the same time.

:::

For cluster-level traffic limiting, you can use a Redis server. The counter will be shared between different APISIX nodes to achieve traffic limiting.

Expand Down
12 changes: 6 additions & 6 deletions docs/zh/latest/plugins/limit-count.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ curl -i http://127.0.0.1:9180/apisix/admin/routes/2 \
}'
```

:::note 注意

同一个 `group` 里面的 `limit-count` 的配置必须保持一致。一旦修改了配置,你需要更新对应的 `group` 的值。

:::

通过将 `key_type` 设置为 `"constant"`,你也可以在所有请求间共享同一个限流计数器:

```shell
Expand Down Expand Up @@ -182,6 +176,12 @@ curl -i http://127.0.0.1:9180/apisix/admin/services/1 \

以上配置表示:当多个路由中 `limit-count` 插件的 `group` 属性均配置为 `services_1#1640140620` 时,访问这些路由的请求将会共享同一个计数器,即使这些请求来自于不同的 IP 地址。

:::note 注意

同一个 `group` 里面的 `limit-count` 的配置必须保持一致。如果修改配置,需要同时更新对应的 `group` 的值。

:::

如果你需要一个集群级别的流量控制,我们可以借助 Redis 服务器来完成。不同的 APISIX 节点之间将共享流量限速结果,实现集群流量限速。

以下示例展示了如何在指定路由上启用 `redis` 策略:
Expand Down

0 comments on commit ad1f122

Please sign in to comment.