版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
第SpringCloudHystrixDashboard服務(wù)監(jiān)控詳解目錄hystrixDashboard服務(wù)監(jiān)控?cái)嗦菲餮菔颈O(jiān)控監(jiān)控8001注意事項(xiàng)監(jiān)控測(cè)試監(jiān)控狀態(tài)
hystrixDashboard服務(wù)監(jiān)控
除了隔離依賴(lài)服務(wù)的調(diào)用以外,Hystrix還提供了準(zhǔn)實(shí)時(shí)的調(diào)用監(jiān)控(HystrixDashboard),Hystrix會(huì)持續(xù)地記錄所有通過(guò)Hystrix發(fā)起的請(qǐng)求的執(zhí)行信息,并以統(tǒng)計(jì)報(bào)表和圖形的形式展示給用戶(hù),包括每秒執(zhí)行多少請(qǐng)求多少成功,多少失敗等。Netflix通過(guò)hystrix-metrics-event-stream項(xiàng)目實(shí)現(xiàn)了對(duì)以上指標(biāo)的監(jiān)控。SpringCloud也提供了HystrixDashboard的整合,對(duì)監(jiān)控內(nèi)容轉(zhuǎn)化成可視化界面。
1、新建cloud-consumer-hystrix-dashboard9001儀表盤(pán)監(jiān)控模塊
2、修改pom.xml文件引入儀表盤(pán)依賴(lài)
核心依賴(lài):spring-cloud-starter-netflix-hystrix-dashboard
注意:所有的圖形化展示,都需要引入spring-boot-starter-actuator依賴(lài),在8001、8002上都需要引入
xmlversion="1.0"encoding="UTF-8"
projectxmlns="/POM/4.0.0"
xmlns:xsi="/2001/XMLSchema-instance"
xsi:schemaLocation="/POM/4.0.0/xsd/maven-4.0.0.xsd"
parent
artifactIdspringcloud2025/artifactId
groupIdcom.zcl.springcloud/groupId
version1.0-SNAPSHOT/version
/parent
modelVersion4.0.0/modelVersion
artifactIdcloud-consumer-hystrix-dashboard9001/artifactId
properties
piler.source8/piler.source
piler.target8/piler.target
/properties
dependencies
dependency
groupIdorg.springframework.cloud/groupId
artifactIdspring-cloud-starter-netflix-hystrix-dashboard/artifactId
/dependency
dependency
groupIdorg.springframework.boot/groupId
artifactIdspring-boot-starter-actuator/artifactId
/dependency
dependency
groupIdorg.springframework.boot/groupId
artifactIdspring-boot-devtools/artifactId
scoperuntime/scope
optionaltrue/optional
/dependency
dependency
groupIdjectlombok/groupId
artifactIdlombok/artifactId
optionaltrue/optional
/dependency
dependency
groupIdorg.springframework.boot/groupId
artifactIdspring-boot-starter-test/artifactId
scopetest/scope
/dependency
/dependencies
/project
3、添加YAML配置文件
server:
port:9001
4、建立啟動(dòng)類(lèi)
必須要加上@EnableHystrixDashboard注解激活
packagecom.zcl.springcloud;
importorg.springframework.boot.SpringApplication;
importorg.springframework.boot.autoconfigure.SpringBootApplication;
importflix.hystrix.dashboard.EnableHystrixDashboard;
*描述:儀表盤(pán)啟動(dòng)類(lèi)
@SpringBootApplication
@EnableHystrixDashboard
publicclassHystrixDashboardMain9001{
publicstaticvoidmain(String[]args){
SpringApplication.run(HystrixDashboardMain9001.class,args);
}
5、啟動(dòng)項(xiàng)目
啟動(dòng)項(xiàng)目測(cè)試:http://localhost:901/hystrix
使用方法:在下面頁(yè)面中輸入需要進(jìn)行監(jiān)控的地址即可
斷路器演示監(jiān)控
監(jiān)控8001注意事項(xiàng)
1、必須要有如下的兩個(gè)依賴(lài)
!--web--
dependency
groupIdorg.springframework.boot/groupId
artifactIdspring-boot-starter-web/artifactId
/dependency
dependency
groupIdorg.springframework.boot/groupId
artifactIdspring-boot-starter-actuator/artifactId
/dependency
2、對(duì)啟動(dòng)類(lèi)的修改
注意:新版本Hystrix需要在主啟動(dòng)類(lèi)MainAppHystrix8001中指定監(jiān)控路徑,否則會(huì)出現(xiàn)報(bào)錯(cuò)
packagecom.zcl.springcloud;
importflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
importorg.springframework.boot.SpringApplication;
importorg.springframework.boot.autoconfigure.SpringBootApplication;
importorg.springframework.boot.web.servlet.ServletRegistrationBean;
importorg.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
importflix.eureka.EnableEurekaClient;
importorg.springframework.context.annotation.Bean;
*描述:熔斷限流啟動(dòng)類(lèi)
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
publicclassPaymentHystrixMain8001{
publicstaticvoidmain(String[]args){
SpringApplication.run(PaymentHystrixMain8001.class,args);
*此配置是為了服務(wù)監(jiān)控而配置,與服務(wù)容錯(cuò)本身無(wú)關(guān),springcloud升級(jí)后的坑
*ServletRegistrationBean因?yàn)閟pringboot的默認(rèn)路徑不是"/hystrix.stream",
*只要在自己的項(xiàng)目里配置上下面的servlet就可以了
@Bean
publicServletRegistrationBeangetServlet(){
HystrixMetricsStreamServletstreamServlet=newHystrixMetricsStreamServlet();
ServletRegistrationBeanregistrationBean=newServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
returnregistrationBean;
}
監(jiān)控測(cè)試
啟動(dòng)7001Eurek
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 公共安全監(jiān)管人員安全知識(shí)測(cè)試題庫(kù)及答案
- LG(中國(guó))招聘面試題及答案
- 大學(xué)語(yǔ)文考研試題及答案
- 中建東孚2026屆校園招聘考試備考題庫(kù)附答案
- 關(guān)于南昌市灣里管理局2025年度公開(kāi)選調(diào)事業(yè)單位工作人員的【24人】考試備考題庫(kù)附答案
- 廣發(fā)證券分支機(jī)構(gòu)“星·起點(diǎn)”培訓(xùn)生2026屆校招參考題庫(kù)附答案
- 昆侖集團(tuán)2026屆大學(xué)畢業(yè)生招聘參考題庫(kù)必考題
- 浙江國(guó)企招聘-2025年臺(tái)州市椒江城建置業(yè)有限公司招聘編外工作人員4人考試備考題庫(kù)必考題
- 湖北省屬?lài)?guó)企外包員工招聘參考題庫(kù)附答案
- 自貢市沿灘區(qū)瓦市鎮(zhèn)人民政府2026年編外人員招聘參考題庫(kù)必考題
- 傳染病學(xué)-病毒性肝炎
- 電氣試驗(yàn)報(bào)告模板
- 重慶市沙坪壩小學(xué)小學(xué)語(yǔ)文五年級(jí)上冊(cè)期末試卷
- 陶瓷巖板應(yīng)用技術(shù)規(guī)程
- 中藥制劑技術(shù)中職PPT完整全套教學(xué)課件
- 龍虎山正一日誦早晚課
- WORD版A4橫版密封條打印模板(可編輯)
- 1比較思想政治教育
- 藝術(shù)課程標(biāo)準(zhǔn)(2022年版)
- JJF 1654-2017平板電泳儀校準(zhǔn)規(guī)范
- 上海市工業(yè)用水技術(shù)中心-工業(yè)用水及廢水處理課件
評(píng)論
0/150
提交評(píng)論