控制台
jar 下载:github.com/alibaba/Sen…
启动参数
# 将控制台自身接入到sentinel
nohup java -jar -Dproject.name=sentinel-dashboard -Dcsp.sentinel.dashboard.server=localhost:8181 sentinel-dashboard-1.8.5.jar --server.port=8181 &> sentinel.log &
# -Dsentinel.dashboard.auth.username=sentinel
# -Dsentinel.dashboard.auth.password=sentinel
控制台页面
![](https://img-blog.csdnimg.cn/img_convert/29236f47a25dba5f8d5dc5d540c34e21.png)
心跳时间
通过多次刷新页面,发现默认每隔10秒发送一次心跳。
![](https://img-blog.csdnimg.cn/img_convert/e39f01a3d827905760f4ed817f71b07d.png)
规则下发
端口配置会在应用对应的机器上启动一个 Http Server ,该 Server 会与 Sentinel 控制台 做交互。
比如 Sentinel 控制台添加了一个限流规则,会把规则数据 push 给这个 Http Server 接收,Http Server 再将规则注册到 Sentinel 中。
接入Nacos
pom
<!-- spring cloud alibaba nacos discovery 依赖 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<version>2021.1</version>
</dependency>
yaml
spring:
application:
name: cloud-alibaba-sentinel
cloud:
nacos:
discovery:
enabled: true