整合sentinel

一、下載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
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容