项目中加入sentinel

项目中加入sentinel

build.gradle

plugins {
  id 'org.springframework.boot' version '2.6.11'
  id 'io.spring.dependency-management' version '1.0.11.RELEASE'
  id 'java'
  id 'maven'
}

group = 'com.emapgo'
archivesBaseName = 'hdmap4'
version = '1.0.0'
sourceCompatibility = '1.8'

repositories {
    mavenLocal()
    maven {
        url "http://maven.aliyun.com/nexus/content/groups/public/"
    }
}

dependencies {    
    
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2021.0.4.0')
    compile('com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:2021.0.4.0')
    compile('com.alibaba.cloud:spring-cloud-starter-alibaba-sentinel:2021.0.4.0')
    compile('com.alibaba.csp:sentinel-transport-simple-http:1.8.6')
  
}

com.alibaba.cloud:spring-cloud-starter-alibaba-sentinel:2021.0.4.0
添加该包使项目支持sentinel熔断限流
com.alibaba.csp:sentinel-transport-simple-http:1.8.6
添加该包使服务与sentinel-dashboard通信

applicatoin.yaml

server:
  port: 8080
spring:
  cloud:
    nacos:
      config:
        server-addr: 192.168.3.2:30848
        namespace: dev
      discovery:
        register-enabled: true
        server-addr: 192.168.3.2:30848
        namespace: dev
        group: test
        service: provider
    sentinel:
      transport:
        port: 8719
        dashboard: 192.168.3.2:30880
  config:
    import:
      - optional:nacos:hdmap4?group=test

port: sentinel-dashboard推送通信端口
dashboard: sentinel-dashboard服务地址和端口

dashboard

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值