sentinel 控制台接入

SpringBoot应用==

1. 引入sentinel通信 依赖(你可以在maven仓库查找最新版,点击直接查看)

<!--接入ali sentinel 控制台的包-->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-alibaba-sentinel</artifactId>
    <version>0.2.0.RELEASE</version>
</dependency>

2. 在application.yml中配置 

spring:
  application:
    name: cf-coupon-service
  #该应用注册到 sentinel 控制台
cloud:
  sentinel:
    transport:
      dashboard: localhost:8080  # 控制台地址

3. Controller中加入@SentinelResource注解

@Controller
public class TController {

    @SentinelResource("testResource")
    @GetMapping("test")
    public void test() {
        
    }
}

4. 启动控制台(下载地址在这里)

java -jar sentinel-dashboard.jar

5. 访问控制台

打开浏览器   http://localhost:8080

OK

猜你喜欢

转载自www.cnblogs.com/selfchange/p/9933972.html