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

docs: update limit count plugin doc #8196

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved

:::note notice
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
:::note notice
:::note

Copy link
Contributor

Choose a reason for hiding this comment

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

English does not need to be annotated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


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