Skip to content

Commit c6fa87e

Browse files
committed
Keep consistent with apache#12727, remove extra ---, and avoid redundant spaces.
1 parent 226fa59 commit c6fa87e

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

docs/zh/latest/tutorials/manage-api-consumers.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ API 消费者是指使用某个 API 的用户,但他们并不会专门为该 A
6767
在本示例中,我们将使用一个基于 [ASP.NET Core Web API](https://learn.microsoft.com/en-us/aspnet/core/?view=aspnetcore-7.0)[示例项目](https://github.com/Boburmirzo/apisix-api-consumers-management),该项目包含一个简单的 `GET` 接口,用于获取商品列表。
6868
项目的运行方式可在其 [README 文件](https://github.com/Boburmirzo/apisix-api-consumers-management#readme) 中找到详细说明。
6969

70-
---
71-
7270
### 为单个消费者启用限流(Rate Limiting)
7371

7472
假设此时示例项目已经启动运行。
@@ -81,8 +79,6 @@ API 消费者是指使用某个 API 的用户,但他们并不会专门为该 A
8179

8280
以上步骤只需通过两条 [curl 命令](https://en.wikipedia.org/wiki/CURL) 调用 APISIX 的 [Admin API](https://apisix.apache.org/zh/docs/apisix/admin-api/) 即可完成。
8381

84-
---
85-
8682
第一条命令创建一个启用了 API Key 认证的 **新消费者**,并配置限流规则:
8783
该消费者在 60 秒内最多只能调用产品 API 两次。
8884

@@ -105,8 +101,6 @@ curl http://127.0.0.1:9180/apisix/admin/consumers -H "X-API-KEY: $admin_key" -X
105101
}'
106102
```
107103

108-
---
109-
110104
接下来,我们定义一个新的 **Route(路由)****Upstream(上游)**
111105
使得所有到达网关端点 `/api/products` 的请求在通过认证后,都会被转发到示例项目的产品服务。
112106

@@ -151,8 +145,6 @@ Server: APISIX/2.13.1
151145

152146
当请求次数达到阈值后,APISIX 将拒绝后续请求。
153147

154-
---
155-
156148
### 为消费者组启用限流(Rate Limiting for Consumer Groups)
157149

158150
在 Apache APISIX 中,[Consumer Group(消费者组)](https://apisix.apache.org/zh/docs/apisix/terminology/consumer-group/) 对象用于管理开发者对后端服务的可见性。
@@ -214,8 +206,6 @@ curl http://127.0.0.1:9180/apisix/admin/consumer_groups/premium_plan -H "X-API-K
214206
在上述步骤中,我们为 **Basic Plan** 设置了限流规则:每 60 秒内仅允许 **2 次请求**
215207
**Premium Plan** 则允许在相同时间窗口内执行 **200 次 API 请求**
216208

217-
---
218-
219209
**创建并将第一个消费者加入 Basic 组**
220210

221211
```shell
@@ -261,8 +251,6 @@ curl http://127.0.0.1:9180/apisix/admin/consumers -H "X-API-KEY: $admin_key" -X
261251
}'
262252
```
263253

264-
---
265-
266254
之后,我们可以验证限流效果:
267255
属于 **Basic Plan** 组的第一个消费者 `consumer1` 在 1 分钟内调用 API 超过 2 次后,将收到 **403 HTTP 状态码错误**
268256
而属于 **Premium Plan** 组的其他两个消费者则可继续请求,直到达到各自的请求上限。
@@ -283,8 +271,6 @@ curl -i http://127.0.0.1:9080/api/products -H 'apikey: auth-three'
283271

284272
请注意,你还可以在任意时刻将消费者添加到或移出消费者组,并启用其他内置插件。
285273

286-
---
287-
288274
## 更多教程
289275

290276
阅读我们的其他 [教程](./expose-api.md),以了解更多有关 **API 管理(API Management)** 的内容。

0 commit comments

Comments
 (0)