启动命令
java -jar sentinel-dashboard-1.8.1.jar --server.port=8082
账号密码都是 sentinel
导入依赖
配置文件配置
spring:cloud:#限流sentinel:transport:#默认地址dashboard: localhost:8082 #配置security验证账号和密码security:user:name: adminpassword: admin #feign 的远程调用开启sentinel的熔断降级配置 feign:sentinel:enabled: true
上代码
@RequestMapping("send1")@SentinelResource(value = "send1",blockHandler = "handleException")public String send1(){return "你好,Sentinel by Url !!!";}public String handleException(BlockException exception){return "限流了";}