一、下載sentinel 控制臺jar包
https://github.com/alibaba/sentinel/releases
注:生產(chǎn)環(huán)境中,sentinel 控制臺保本盡量保持和應(yīng)用的sentinel版本一致

查看應(yīng)用sentinel版本.png
二、啟動sentinel 控制臺
java -jar sentinel-dashboard-1.6.2
localhost:8080 打開sentinel控制臺
三、為內(nèi)容中心整合控制臺
添加jar包
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<version>0.9.0.RELEASE</version>
</dependency>
添加配置
sentinel:
transport:
#指定sentinel控制臺的地址
dashboard: localhost:8080
啟動content-center、user-center服務(wù)
由于sentinel是懶加載,需要先訪問資源才會對資源進行監(jiān)控

沒訪問過任何資源.png
訪問資源http://localhost:8010/shares/1

圖片.png
四、怎么確定應(yīng)用整合了sentinel呢?
應(yīng)用整合了sentinel之后會暴露出來一個/actuator/sentinel的端點
所以需要為應(yīng)用整合actuator
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
actuator暴露/sentinel/actuator端點默認是隱藏的,需要添加配置
management:
endpoints:
web:
exposure:
include: '*'

出現(xiàn)這個頁面說明整合sentinel成功.png