微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Sentinel

目录

1、下载启动

2、修改默认配置

​3、微服务项目使用Sentinel

3.1  加入依赖

 3.2  修改 bootstrap.properties 或 application.properties 配置文件

 3.3  sentinel默认只对controller层的接口生成簇点链路,在server层使用需:


1、下载启动

启动命令:

java -jar sentinel-dashboard-1.8.1.jar

2、修改认配置

修改端口并启动:

java -Dserver.port=8090 -jar sentinel-dashboard-1.8.1.jar

3、微服务项目使用Sentinel

3.1  加入依赖

<dependency>

        <groupId>com.alibaba.cloud</groupId>

        <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>

</dependency>

 3.2  修改 bootstrap.properties 或 application.properties 配置文件

 # 配置sentinel控制台地址

spring.cloud.sentinel.transport.dashboard=localhost:9090

 3.3  sentinel认只对controller层的接口生成簇点链路,在server层使用需:

(1)使用@SentinelResource注解

//注解

@SentinelResource("queryGoods")

(2)修改配置类

 #关闭上下文件

spring.cloud.sentinel.web-context-unify=false

原文地址:https://www.jb51.cc/wenti/3281125.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐