首页 > 编程语言 >[java]-[cloud]-Spring Cloud Alibaba Sentinel

[java]-[cloud]-Spring Cloud Alibaba Sentinel

时间:2023-03-09 21:33:52浏览次数:55  
标签:java Spring Alibaba Sentinel spring sentinel alibaba cloud

1、整合Sentinel

1、pom.xml安装依赖

        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
        </dependency>

2、下载sentinel控制台

地址:https://github.com/alibaba/Sentinel/releases 下载对应的版本

下载完启动:

D:\javaResources\JavaSoftware\springcloud\Sentinel>java -jar sentinel-dashboard-1.7.1.jar --server.port=8333

浏览器访问:http://localhost:8333/ 即可到控制登录页面 账户:sentinel 密码: sentinel

3、配置 sentinel 控制台地址信息

application.properties

spring.cloud.sentinel.transport.dashboard=localhost:8333
spring.cloud.sentinel.transport.port=8719

4、在控制台调整参数、【默认所有的流控规则保存在内存中,重启失效】

2、每一个微服务都导入 actuator :

并配合 management.endpoints.web.exposure.include=*

pom.xml

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

application.properties

management.endpoints.web.exposure.include=*

3、自定义 sentinel 流控返回的数据

标签:java,Spring,Alibaba,Sentinel,spring,sentinel,alibaba,cloud
From: https://www.cnblogs.com/my-global/p/17182382.html

相关文章