<!--Sentinel-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
@RestController
@Slf4j
public class OrderControllerTwo {
@RequestMapping("/order/message1")
public String message1(){
return "测试高并发";
}
@RequestMapping("/order/message2")
public String message2(){
return "测试高并发";
}
}
https://github.com/alibaba/Sentinel/releases
#直接使用jar命令启动项目(控制台本身是一个SpringBoot项目)
java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -jar sentinel-dashboard-1.7.0.jar
spring:
cloud:
sentinel:
transport:
port: 9999
dashboard: 192.168.110.130:8080
1.通过控制台为message1添加一个流量控制规则
image
image
2.通过控制台快速频繁访问,观察效果
image
docker run --name sentinel-dashboard -d -p 8858:8858 bladex/sentinel-dashboard:1.7.0
作者:LANSHENGYANG
链接:https://www.jianshu.com/p/1b0c71d33057
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
全部评论