From 567d646ea2f79d775b31120d0dbbfa527a0fad98 Mon Sep 17 00:00:00 2001 From: zlt Date: Sat, 3 Aug 2019 16:40:23 +0800 Subject: [PATCH] =?UTF-8?q?api=E7=BD=91=E5=85=B3=E9=9B=86=E6=88=90Sentinel?= =?UTF-8?q?=E7=BD=91=E5=85=B3=E6=B5=81=E6=8E=A7=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zlt-gateway/zuul-gateway/pom.xml | 5 ++++ .../src/main/resources/application.yml | 25 ++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/zlt-gateway/zuul-gateway/pom.xml b/zlt-gateway/zuul-gateway/pom.xml index b73b03d8..bce32be4 100644 --- a/zlt-gateway/zuul-gateway/pom.xml +++ b/zlt-gateway/zuul-gateway/pom.xml @@ -32,6 +32,11 @@ com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery + + com.alibaba.cloud + spring-cloud-alibaba-sentinel-gateway + + org.springframework.boot spring-boot-starter-web diff --git a/zlt-gateway/zuul-gateway/src/main/resources/application.yml b/zlt-gateway/zuul-gateway/src/main/resources/application.yml index b185e541..04cc572e 100644 --- a/zlt-gateway/zuul-gateway/src/main/resources/application.yml +++ b/zlt-gateway/zuul-gateway/src/main/resources/application.yml @@ -2,28 +2,29 @@ spring: # sentinel动态配置规则 cloud: sentinel: + zuul: + enabled: true + order: + pre: 2000 + post: 500 + error: -100 + filter: + enabled: false datasource: # 限流 ds1: nacos: server-addr: ${zlt.nacos.server-addr} - dataId: ${spring.application.name}-sentinel-flow + dataId: ${spring.application.name}-sentinel-gw-flow groupId: DEFAULT_GROUP - rule-type: flow - # 熔断 + rule-type: gw-flow + # api分组 ds2: nacos: server-addr: ${zlt.nacos.server-addr} - dataId: ${spring.application.name}-sentinel-degrade + dataId: ${spring.application.name}-sentinel-gw-api-group groupId: DEFAULT_GROUP - rule-type: degrade - # 系统负载保护 - ds4: - nacos: - server-addr: ${zlt.nacos.server-addr} - dataId: ${spring.application.name}-sentinel-system - groupId: DEFAULT_GROUP - rule-type: system + rule-type: gw-api-group zlt: oauth2: