In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what is the latest gateway flow control component of zuul integration Sentinel. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
I. explanation
Sentinel gateway traffic control supports traffic control for different routes and custom API packets, and for request attributes (such as URL parameters, Client IP,Header, etc.). Sentinel 1.6.3 introduces the support of gateway traffic control console. Users can view API Gateway real-time route and custom API packet monitoring, manage gateway rules and API packet configuration directly on the Sentinel console.
Second, functional access 1. The gateway adds sentinel-related jar dependencies on com.alibaba.cloud spring-cloud-starter-alibaba-sentinel com.alibaba.csp sentinel-datasource-nacos com.alibaba.cloud spring-cloud-alibaba-sentinel-gateway2. Sentinel configuration of gateway zuul spring: # sentinel dynamic configuration rules cloud: sentinel: zuul: enabled: true order: pre: 2000 post: 500 error:-100 filter: enabled: false datasource: # current limit ds1: nacos: server-addr: ${zlt.nacos.server- Addr} dataId: ${spring.application.name}-sentinel-gw-flow groupId: DEFAULT_GROUP rule-type: gw-flow # api grouping ds2: nacos: server-addr: ${zlt.nacos.server-addr} dataId: ${spring.application.name}-sentinel-gw-api-group groupId: DEFAULT_ GROUP rule-type: gw-api-group
The rule data source that binds gw-flow (current limit) and gw-api-group (api grouping) is nacos and specifies the corresponding dataId and groupId on nacos.
3. Nacos rule configuration 3.1. Current limiting configuration gw-flow
Data ID:api-gateway-sentinel-gw-flow
Group:DEFAULT_GROUP
Configuration content:
[{"resource": "user", "count": 0, "paramItem": {"parseStrategy": 3, "fieldName": "name"}}, {"resource": "uaa_api", "count": 0}]
Rule 1: all user requests are intercepted (qps=0) as long as the parameters with name are intercepted. User is the routeId rule on zuul routing configuration. All requests with uaa_api grouped by 2:api are intercepted (qps=0).
3.2. Api packet configuration gw-api-group
Data ID:api-gateway-sentinel-gw-api-group
Group:DEFAULT_GROUP
Configuration content:
[{"apiName": "uaa_api", "predicateItems": [{"pattern": "/ user/login"}, {"pattern": "/ api-uaa/oauth/**", "matchStrategy": 1}]}]
All the api configured above to meet the rules are grouped into uaa_api grouping rule 1: precise matching / user/login grouping rule 2: prefix matching / api-uaa/oauth/**
4. Gateway zuul startup parameters
You need to add-Dcsp.sentinel.app.type=1 startup to the original startup parameters of the access side to mark your service as API Gateway. When you connect to the console, your service will be automatically registered as a gateway type, and then you can configure gateway rules and API grouping on the console, for example:
Java-Dcsp.sentinel.app.type=1-jar zuul-gateway.jar III. Sentinel console management
API Management (grouping)
Gateway traffic control rules
4. Test current-limiting api1. Test current limit rule 1
All user requests are intercepted (qps=0) as long as the parameter has name.
You can access api without adding name parameter
After the parameter name, the request is intercepted.
two。 Test current limit rule 2
All requests grouped by api as uaa_api are intercepted (qps=0)
Prefix matching / api-uaa/oauth/**
Precise matching / user/login
This is the end of what is the latest gateway flow control component of zuul integration Sentinel. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.