Spring Cloud構建微服務架構-Hystrix監控面板

在Spring Cloud中構建一個Hystrix Dashboard非常簡單,只需要下面四步:愿意了解源碼的朋友直接求求交流分享技術 一零三八七七四六二六

創建一個標準的Spring Boot工程,命名為:hystrix-dashboard。 編輯pom.xml,具體依賴內容如下:

<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Dalston.SR1</version>
<relativePath />
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
復制代碼

為應用主類加上@EnableHystrixDashboard,啟用Hystrix Dashboard功能。


@EnableHystrixDashboard
@SpringCloudApplication
public class HystrixDashboardApplication {
public static void main(String[] args) {
SpringApplication.run(HystrixDashboardApplication.class, args);
}
}
復制代碼

根據實際情況修改application.properties配置文件,比如:選擇一個未被占用的端口等,此步非必須。

spring.application.name=hystrix-dashboard
server.port=1301
復制代碼

既然Hystrix Dashboard監控單實例節點需要通過訪問實例的/hystrix.stream接口來實現,自然我們需要為服務實例添加這個端點,而添加該功能的步驟也同樣簡單,只需要下面兩步:

在服務實例pom.xml中的dependencies節點中新增spring-boot-starter-actuator監控模塊以開啟監控相關的端點,并確保已經引入斷路器的依賴spring-cloud-starter-hystrix:

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
復制代碼

確保在服務實例的主類中已經使用@EnableCircuitBreaker或@EnableHystrix注解,開啟了斷路器功能。完整項目源碼

轉載于:https://juejin.im/post/5c67b30af265da2dbc597a5b

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/388272.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/388272.shtml
英文地址,請注明出處:http://en.pswp.cn/news/388272.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Google 地圖 API 參考

楊航收集技術資料&#xff0c;分享給大家 Google 地圖 API 參考 Google 地圖 API 現在與 Google AJAX API 載入器集成&#xff0c;后者創建了一個公共命名空間&#xff0c;以便載入和使用多個 Google AJAX API。該框架可讓您將可選 google.maps.* 命名空間用于當前在 Google …

spotify歌曲下載_使用Spotify數據預測哪些“ Novidades da semana”歌曲會成為熱門歌曲

spotify歌曲下載TL; DR (TL;DR) Spotify is my favorite digital music service and I’m very passionate about the potential to extract meaningful insights from data. Therefore, I decided to do this article to consolidate my knowledge of some classification mod…

Hook技術之Hook Activity

一、Hook技術概述 Hook技術的核心實際上是動態分析技術&#xff0c;動態分析是指在程序運行時對程序進行調試的技術。眾所周知&#xff0c;Android系統的代碼和回調是按照一定的順序執行的&#xff0c;這里舉一個簡單的例子&#xff0c;如圖所示。 對象A調用類對象B&#xff0c…

(第三周)周報

此作業要求https://edu.cnblogs.com/campus/nenu/2018fall/homework/2143 1.本周PSP 總計&#xff1a;1422 min 2.本周進度條 (1)代碼累積折線圖 (2)博文字數累積折線圖 4.PSP餅狀圖 轉載于:https://www.cnblogs.com/gongylx/p/9761852.html

功能測試代碼python_如何使您的Python代碼更具功能性

功能測試代碼pythonFunctional programming has been getting more and more popular in recent years. Not only is it perfectly suited for tasks like data analysis and machine learning. It’s also a powerful way to make code easier to test and maintain.近年來&am…

layou split 屬性

layou split&#xff1a;true - 顯示側分欄 轉載于:https://www.cnblogs.com/jasonlai2016/p/9764450.html

BZOJ4503:兩個串(bitset)

Description 兔子們在玩兩個串的游戲。給定兩個字符串S和T&#xff0c;兔子們想知道T在S中出現了幾次&#xff0c;分別在哪些位置出現。注意T中可能有“?”字符&#xff0c;這個字符可以匹配任何字符。Input 兩行兩個字符串&#xff0c;分別代表S和TOutput 第一行一個正整數k&…

C#Word轉Html的類

C#Word轉Html的類/**//******************************************************************** created: 2007/11/02 created: 2:11:2007 23:13 filename: D:C#程序練習WordToChmWordToHtml.cs file path: D:C#程序練習WordToChm file bas…

分庫分表的幾種常見形式以及可能遇到的難題

前言 在談論數據庫架構和數據庫優化的時候&#xff0c;我們經常會聽到“分庫分表”、“分片”、“Sharding”…這樣的關鍵詞。讓人感到高興的是&#xff0c;這些朋友所服務的公司業務量正在&#xff08;或者即將面臨&#xff09;高速增長&#xff0c;技術方面也面臨著一些挑戰。…

iOS 鑰匙串的基本使用

級別&#xff1a; ★☆☆☆☆ 標簽&#xff1a;「鑰匙串」「keychain」「iOS」 作者&#xff1a; WYW 審校&#xff1a; QiShare團隊 前言 &#xff1a; 項目中有時會需要存儲敏感信息&#xff08;如密碼、密鑰等&#xff09;&#xff0c;蘋果官方提供了一種存儲機制--鑰匙串&a…

線性回歸和將線擬合到數據

Linear Regression is the Supervised Machine Learning Algorithm that predicts continuous value outputs. In Linear Regression we generally follow three steps to predict the output.線性回歸是一種監督機器學習算法&#xff0c;可預測連續值輸出。 在線性回歸中&…

Spring Boot MyBatis配置多種數據庫

mybatis-config.xml是支持配置多種數據庫的&#xff0c;本文將介紹在Spring Boot中使用配置類來配置。 1. 配置application.yml # mybatis配置 mybatis:check-config-location: falsetype-aliases-package: ${base.package}.modelconfiguration:map-underscore-to-camel-case: …

小米盒子4 拆解圖解_我希望當我開始學習R時會得到的盒子圖解指南

小米盒子4 拆解圖解Customizing a graph to transform it into a beautiful figure in R isn’t alchemy. Nonetheless, it took me a lot of time (and frustration) to figure out how to make these plots informative and publication-quality. Rather than hoarding this …

組態王仿真隨機數

1、新建IO設備&#xff0c;選擇PLC---亞控---仿真PLC&#xff0c;一直“下一步”。 2、在“數據詞典”中新建變量“Tag1”&#xff0c;雙擊Tag1&#xff0c;變量類型選&#xff1a;I/O實數&#xff1b;初始值設為&#xff1a;0.6&#xff1b;最小值設為&#xff1a;0.5&#xf…

藍牙一段一段_不用擔心,它在那里存在了一段時間

藍牙一段一段You’re sitting in a classroom. You look around and see your friends writing something down. It seems they are taking the exam, and they know all the answers (even Johnny who, how to say it… wasn’t the brilliant one). You realize that your ex…

Linux基礎命令---ifup、ifdown

ifupifup指令用來啟動網絡接口設備&#xff0c;設備必須是定義在“/etc/sysconfig/network-scripts/ifcfg-ethX”或者“/etc/sysconfig/network”的文件。這些腳本通常使用一個參數&#xff1a;配置的名稱(例如eth0)。在引導序列中&#xff0c;使用“boot”的第二個參數調用它們…

OllyDBG 入門之四--破解常用斷點設

OllyDBG 入門之四--破解常用斷點&#xff08;轉&#xff09; 軟件漢化2010-07-08 16:25:23 閱讀76評論0 字號&#xff1a;大中小 訂閱 bpx hmemcpy 破解萬能斷點&#xff0c;攔截內存拷貝動作 bpx Lockmytask 當你用其它斷點都無效時可以試一下&#xff0c;這個斷點攔截…

POJ1204 Word Puzzles

傳送門 這題果然是AC自動機的大好題&#xff01; 題目的大意是&#xff0c;給定一個l*c的大網格&#xff0c;每個格子里有一個字符&#xff0c;每個格子可以向八個方向形成字符串&#xff0c;問給定的字符串在哪里能被匹配以及在網格中出現的方向&#xff08;A代表北&#xff0…

普通話測試系統_普通話

普通話測試系統Traduzido/adaptado do original por Vincius Barqueiro a partir do texto original “Writing Alt Text for Data Visualization”, escrito por Amy Cesal e publicado no blog Nightingale.Traduzido / adaptado由 VinciusBarqueiro 提供原始 文本“為數據可…

Mac OS 被XCode搞到無法正常開機怎么辦?

Mac OS 被XCode搞到無法正常開機怎么辦&#xff1f; 第一天拿到這臺air的時候&#xff0c;迫不及待地把從別處搜集來的XCode 3.2.5iOS SDK 4.1的dmg安裝了上來&#xff0c;結果系統直接崩潰&#xff0c;再開機就不能正常開機&#xff0c;總是碰到kernel panic。這不坑爹嗎…… …