sentinel、nacos持久化

sentinel依赖

<!--Sentinel 限熔断流-->
<dependency>
	<groupId>com.alibaba.cloud</groupId>
	<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>

nacos依赖

<!--Spring Cloud Alibaba-->
<dependency>
	<groupId>com.alibaba.cloud</groupId>
	<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!--用于Sentinel持久化-->
<dependency>
	<groupId>com.alibaba.csp</groupId>
	<artifactId>sentinel-datasource-nacos</artifactId>
</dependency>

application.yml配置

server:
  port: 8010
  
mybatis-plus:
  mapper-locations: classpath:mapper/*.xml

spring:
  datasource:
    url: jdbc:mysql://192.168.40.66:3306/tcp_store?useSSL=false
    username: root
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver
  application:
    #服务名称   nacos服务列表里的服务名
    name: account-service
  cloud:
    nacos:
      discovery:
        #nacos地址
        server-addr: 192.168.40.66:8848
        ip: 192.168.40.1
    sentinel:
      transport:
        dashboard: 192.168.40.66:8858
        client-ip: 192.168.40.1
      eager: true
      datasource:
        ds:
          nacos:
            serverAddr: 192.168.40.66:8848
            dataId: account-service-sentinel
            groupId: DEFAULT_GROUP
            dataType: json
            ruleType: FLOW

nacos配置
在这里插入图片描述

[
    {
        "resource": "getByCode",
        "limitApp": "default",
        "grade": 1,
        "count": 3,
        "strategy": 0,
        "controlBehavior": 0,
        "clusterMode": false
    }
]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值