springboot-alibabacloud-sentinel

2020-11-30  本文已影响0人  前进的码农

官方文档

sentinel介绍

https://github.com/alibaba/Sentinel/wiki/%E4%B8%BB%E9%A1%B5

sentinel和alibabacloud结合手册

https://github.com/alibaba/spring-cloud-alibaba/wiki/Sentinel

控制台安装

参考第一篇文章
https://www.jianshu.com/writer#/notebooks/48706360/notes/80553677

使用

引入pom

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

在配置文件中配置交互配置

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

随便写一个get接口然后访问

进入Sentinel控制台给刚刚的写的接口配置流控规则

image.png

为了方便测试我这里的设置qps为1

效果

把刚刚写的接口地址输入到浏览器刷新


image.png

不停的刷新就会看到流控的效果。

上一篇 下一篇

猜你喜欢

热点阅读