您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这篇文章主要介绍“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怎么设置”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。