springcloud 集成Sentinel 1.8持久化到nacos
2021-03-06 08:27
标签:framework loading info 规则 sys work dash rgba 名称 1、客户端pom引入 2、yaml文件修改 3、测试 springcloud 集成Sentinel 1.8持久化到nacos 标签:framework loading info 规则 sys work dash rgba 名称 原文地址:https://www.cnblogs.com/ldmy/p/14302332.html dependency>
groupId>com.alibaba.cloudgroupId>
artifactId>spring-cloud-starter-alibaba-sentinelartifactId>
version>2.2.4.RELEASEversion>
exclusions>
exclusion>
groupId>com.alibabagroupId>
artifactId>fastjsonartifactId>
exclusion>
exclusions>
dependency>
dependency>
groupId>com.alibaba.cspgroupId>
artifactId>sentinel-datasource-nacosartifactId>
version>1.8.0version>
dependency>
spring:
cloud:
sentinel:
port: 8719
eager: true
transport:
# sentinel客户端地址
dashboard: 127.0.0.1:8080
datasource:
flow:
nacos:
#nacos地址
server-addr: ${spring.cloud.nacos.discovery.server-addr}
#nacos dataId 详细看 sentinel 客户端添加到nacos下的保持一致
dataId: ${spring.application.name}-flow-rules
#nacos namespace 详细看 sentinel 客户端添加到nacos下的保持一致
namespace: ${spring.cloud.nacos.discovery.namespace}
#nacos namespace 详细看 sentinel 客户端添加到nacos下的保持一致
groupId: SENTINEL_GROUP
#data-type: json
# 规则类型,取值见:
# org.springframework.cloud.alibaba.sentinel.datasource.RuleType
rule-type: flow
#熔断降级 名称随意
degrade:
nacos:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
dataId: ${spring.application.name}-degrade-rules
namespace: ${spring.cloud.nacos.discovery.namespace}
groupId: SENTINEL_GROUP
rule-type: degrade
#系统规则 名称随意
system:
nacos:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
dataId: ${spring.application.name}-system-rules
namespace: ${spring.cloud.nacos.discovery.namespace}
groupId: SENTINEL_GROUP
rule-type: system
#授权规则 名称随意
authority:
nacos:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
dataId: ${spring.application.name}-authority-rules
namespace: ${spring.cloud.nacos.discovery.namespace}
groupId: SENTINEL_GROUP
rule-type: authority
#参数规则 名称随意
param-flow:
nacos:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
dataId: ${spring.application.name}-param-flow-rules
namespace: ${spring.cloud.nacos.discovery.namespace}
groupId: SENTINEL_GROUP
rule-type: param-flow
在sentinel 客户端增加 接口的 熔断规则后 访问该接口 出现如下场景 即是成功
文章标题:springcloud 集成Sentinel 1.8持久化到nacos
文章链接:http://soscw.com/index.php/essay/60772.html