1:下載sentinel-Dashboard的源碼或者jar:地址:https://github.com/alibaba/Sentinel/releases
2:部署Dashboard
3:spring boot工程添加如下配置:
spring: cloud: sentinel: transport: # 指定sentinel控制台地址 dashboard: 10.100.10.84:9016 # 指定和控制台通信的IP,若不配置,會自動選擇一個IP注冊 client-ip: ${eureka.instance.ip-address} # 指定和控制台通信的端口哦,默認值8719 # 若不配置,會自動掃貓從8719開始掃貓,依次+1,知道值找到未被占用的端口 port: ${thc.sentinel.port} # 心跳發送周期,默認值null # 但在SimpleHttpHeartbeatSender會用默認值10秒 heartbeat-interval-ms: 10000
4:pom文件引入jar
<!-- sentinel --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> <version>2.1.1.RELEASE</version> </dependency>
5:訪問一個接口去部署Dashboard的地址查看相關信息吧!
6:效果圖如下:
7:附上基礎頁面使用教程