sentinel持久化进nacos

nacos首先要持久化进mysql
配置

  <!-- SpringCloud ailibaba sentinel-datasource-nacos 持久化需要用到-->
        <dependency>
            <groupId>com.alibaba.csp</groupId>
            <artifactId>sentinel-datasource-nacos</artifactId>
        </dependency>
server:
  port: 8401

spring:
  application:
    name: cloudalibaba-sentinal-service
  cloud:
    nacos:
      discovery:
        #Nacos服务注册中心地址
        server-addr: localhost:8848
    sentinel:
      transport:
        #配置Sentin dashboard地址
        dashboard: localhost:8080
        # 默认8719端口,假如被占用了会自动从8719端口+1进行扫描,直到找到未被占用的 端口
        port: 8719
      datasource:#关键点在这个配置Nacos
        ds1:
          nacos:
            server-addr: localhost:8848
            dataId: cloudalibaba-sentinal-service
            groupId: DEFAULT_GROUP
            data-type: json
            rule-type: flow
management:
  endpoints:
    web:
      exposure:
        include: '*'



sentinel持久化进nacos_第1张图片
名称一定要一样,这里的名称是
cloudalibaba-sentinal-service

sentinel持久化进nacos_第2张图片

你可能感兴趣的:(java)