Sentinel熔断降级用法
最后更新于:2022-04-02 07:10:15
[TOC]
## jeecg-cloud-sentinel

### sentinel使用准备
#### 启动sentinel项目
com.alibaba.csp.sentinel.dashboard.JeecgSentinelDashboardApplication

#### 访问地址
[http://localhost:8087](http://localhost:8087)
账号密码:sentinel/sentinel

**说明:第一次访问,内容是空。**

访问gateway任意接口,就会出现应用

#### 网关中(gateway)配置sentinel
添加sentinel依赖

添加sentinel配置

### 限流某个微服务模块的全部接口



添加成功后nacos中会自动生成jeecg-gateway-flow-rules文件 如下图

查看nacos文件内容

访问某个接口进行测试
1秒点一下测试结果如下

快速点击测试结果如下

说明我们的限流配置起了作用
### 如何配置单独限制某个接口


**docker 部署脚本:**
`bladex/sentinel-dashboard`, 默认账号密码为 \[sentinel sentinel\]
```
version: '3.5'
services:
sentinel-dashboard:
image: bladex/sentinel-dashboard:1.8.0
container_name: sentinel-dashboard
#account and password: [sentinel sentinel]
#修改默认密码为 123456
environment:
- sentinel.dashboard.auth.password=123456
restart: always
ports:
- 8858:8858
```
* 官方文档:https://sentinelguard.io/zh-cn/docs/dashboard.html
';