这篇文章主要介绍“kong插件rate-limiting怎么设置”,在日常操作中,相信很多人在kong插件rate-limiting怎么设置问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”kong插件rate-limiting怎么设置”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
为辉南等地区用户提供了全套网页设计制作服务,及辉南网站建设行业解决方案。主营业务为网站设计、成都做网站、辉南网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
设置全局插件rate-limiting ,每分钟请求次数是5次 数据存储在本地内存中
curl -i -X POST http://localhost:8001/plugins \--data "name=rate-limiting" \--data "config.minute=5" \--data "config.policy=local"HTTP/1.1 201 CreatedDate: Fri, 31 Jul 2020 08:23:16 GMTContent-Type: application/json; charset=utf-8Connection: keep-aliveAccess-Control-Allow-Origin: *Server: kong/2.1.0Content-Length: 497X-Kong-Admin-Latency: 10{"created_at":1596183796,"id":"5beb7c20-b8a3-4fb1-a0b1-2a6b5ed9af20","tags":null,"enabled":true,"protocols":["grpc","grpcs","http","https"],"name":"rate-limiting","consumer":null,"service":null,"route":null,"config":{"hide_client_headers":false,"minute":5,"policy":"local","month":null,"redis_timeout":2000,"limit_by":"consumer","redis_password":null,"second":null,"day":null,"redis_database":0,"year":null,"hour":null,"redis_host":null,"redis_port":6379,"header_name":null,"fault_tolerant":true}}
连续请求6次
curl -i -X GET http://localhost:8000/mock/requestHTTP/1.1 429 Too Many RequestsDate: Fri, 31 Jul 2020 08:24:37 GMTContent-Type: application/json; charset=utf-8Connection: keep-aliveRetry-After: 23Content-Length: 41X-RateLimit-Remaining-Minute: 0X-RateLimit-Limit-Minute: 5RateLimit-Remaining: 0RateLimit-Limit: 5RateLimit-Reset: 23X-Kong-Response-Latency: 1Server: kong/2.1.0{ "message":"API rate limit exceeded"}
到此,关于“kong插件rate-limiting怎么设置”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款