1. 程式人生 > >springcloud(五):熔斷監控Hystrix Dashboard和Turbine

springcloud(五):熔斷監控Hystrix Dashboard和Turbine

Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請求成功率等資料。但是隻使用Hystrix Dashboard的話, 你只能看到單個應用內的服務資訊, 這明顯不夠. 我們需要一個工具能讓我們彙總系統內多個服務的資料並顯示到Hystrix Dashboard上, 這個工具就是Turbine.

Hystrix Dashboard

我們在熔斷示例專案spring-cloud-consumer-hystrix的基礎上更改,重新命名為:spring-cloud-consumer-hystrix-dashboard。

1、新增依賴

<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>

這三個包必須新增

2、啟動類

啟動類新增啟用Hystrix Dashboard和熔斷器

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@EnableHystrixDashboard
@EnableCircuitBreaker public class ConsumerApplication { public static void main(String[] args) { SpringApplication.run(ConsumerApplication.class, args); } }

3、測試

啟動工程後訪問 http://localhost:9001/hystrix,將會看到如下介面:

圖中會有一些提示:

Cluster via Turbine (default cluster): http://turbine-hostname:port/turbine.stream 
Cluster via Turbine (custom cluster): http://turbine-hostname:port/turbine.stream?cluster=[clusterName]
Single Hystrix App: http://hystrix-app:port/hystrix.stream

大概意思就是如果檢視預設叢集使用第一個url,檢視指定叢集使用第二個url,單個應用的監控使用最後一個,我們暫時只演示單個應用的所以在輸入框中輸入: http://localhost:9001/hystrix.stream ,輸入之後點選 monitor,進入頁面。

如果沒有請求會先顯示Loading ...,訪問http://localhost:9001/hystrix.stream 也會不斷的顯示ping。

請求服務http://localhost:9001/hello/neo,就可以看到監控的效果了,首先訪問http://localhost:9001/hystrix.stream,顯示如下:

ping: 

data: {"type":...}

data: {"type":...}

說明已經返回了監控的各項結果

到監控頁面就會顯示如下圖:

其實就是http://localhost:9001/hystrix.stream返回結果的圖形化顯示,Hystrix Dashboard Wiki上詳細說明了圖上每個指標的含義,如下圖:

到此單個應用的熔斷監控已經完成。

Turbine

在複雜的分散式系統中,相同服務的節點經常需要部署上百甚至上千個,很多時候,運維人員希望能夠把相同服務的節點狀態以一個整體叢集的形式展現出來,這樣可以更好的把握整個系統的狀態。 為此,Netflix提供了一個開源專案(Turbine)來提供把多個hystrix.stream的內容聚合為一個數據源供Dashboard展示。

1、新增依賴

<dependencies>
	<dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-starter-turbine</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-netflix-turbine</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-actuator</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
	</dependency>
</dependencies>

2、配置檔案

spring.application.name=hystrix-dashboard-turbine
server.port=8001
turbine.appConfig=node01,node02
turbine.aggregator.clusterConfig= default
turbine.clusterNameExpression= new String("default")

eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/
  • turbine.appConfig :配置Eureka中的serviceId列表,表明監控哪些服務
  • turbine.aggregator.clusterConfig :指定聚合哪些叢集,多個使用”,”分割,預設為default。可使用http://.../turbine.stream?cluster={clusterConfig之一}訪問
  • turbine.clusterNameExpression : 1. clusterNameExpression指定叢集名稱,預設表示式appName;此時:turbine.aggregator.clusterConfig需要配置想要監控的應用名稱;2. 當clusterNameExpression: default時,turbine.aggregator.clusterConfig可以不寫,因為預設就是default;3. 當clusterNameExpression: metadata[‘cluster’]時,假設想要監控的應用配置了eureka.instance.metadata-map.cluster: ABC,則需要配置,同時turbine.aggregator.clusterConfig: ABC

3、啟動類

啟動類新增@EnableTurbine,啟用對Turbine的支援

@SpringBootApplication
@EnableHystrixDashboard
@EnableTurbine
public class DashboardApplication {

	public static void main(String[] args) {
		SpringApplication.run(DashboardApplication.class, args);
	}

}

到此Turbine(hystrix-dashboard-turbine)配置完成

4、測試

在示例專案spring-cloud-consumer-hystrix基礎上修改為兩個服務的呼叫者spring-cloud-consumer-node1和spring-cloud-consumer-node2

spring-cloud-consumer-node1專案改動如下: application.properties檔案內容

spring.application.name=node01
server.port=9001
feign.hystrix.enabled=true

eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/

spring-cloud-consumer-node2專案改動如下: application.properties檔案內容

spring.application.name=node02
server.port=9002
feign.hystrix.enabled=true

eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/

HelloRemote類修改:

@FeignClient(name= "spring-cloud-producer2", fallback = HelloRemoteHystrix.class)
public interface HelloRemote {

    @RequestMapping(value = "/hello")
    public String hello2(@RequestParam(value = "name") String name);

}

相關推薦

springcloud()熔斷監控Hystrix DashboardTurbine

Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請求成功率等資料。但是隻使用Hystrix Dashboard的話, 你只能看到單個應用內的服務資訊, 這明顯不夠. 我們需

Java B2B2C多使用者商城 springboot架構()熔斷監控Hystrix DashboardTurbine

Hystrix Dashboard 我們在熔斷示例專案spring-cloud-consumer-hystrix的基礎上更改,重新命名為:spring-cloud-consumer-hystrix-dashboard。 1、新增依賴 <dependency> <group

()java B2B2C Springcloud電子商城系統熔斷監控Hystrix DashboardTurbine

cati nbsp 一個數 onf pid 開源項目 back 單個 com Hystrix Dashboard 我們在熔斷示例項目spring-cloud-consumer-hystrix的基礎上更改,重新命名為:spring-cloud-consumer-hystrix

跟我學SpringCloud | 第熔斷監控Hystrix DashboardTurbine

SpringCloud系列教程 | 第五篇:熔斷監控Hystrix Dashboard和Turbine Springboot: 2.1.6.RELEASE SpringCloud: Greenwich.SR1 如無特殊說明,本系列教程全採用以上版本 Hystrix-dashboard是一款針對Hy

springcloud()熔斷監控Hystrix Dashboard

actuator 會有 con oss ces 使用 board 實時監控 指標 Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請求成

(四)java springcloud b2b2c shop 多用戶商城系統熔斷監控Hystrix DashboardTurbine熔斷器Hystrix

over 多個 導致 通過 this gif spring 調用 -c 說起springcloud熔斷讓我想起了去年股市中的熔斷,多次痛的領悟,隨意實施的熔斷對整個系統的影響是災難性的,好了接下來我們還是說正事。 熔斷器 雪崩效應 在微服務架構中通常會有多個服務層調用,基礎

Spring Cloud熔斷監控Hystrix DashboardTurbine(05)

Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請求成功率等資料。但是隻使用Hystrix Dashboard的話, 你只能看到單個應用內的服務資訊, 這明顯不夠

spring cloud()熔斷監控Hystrix DashboardTurbine

image 部署 Turbine 時間 基礎上 rop url ghost 技術分享 Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請

微服務SpringCloud熔斷監控Hystrix DashboardTurbine

Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請求成功率等資料。但是隻使用Hystrix Dashboard的話, 你只能看到單個應用內的服務資訊, 這明顯不夠. 我們需

SpringCloud 熔斷監控Hystrix Dashboard & Turbine

個人學習SpringCloud系列 熔斷監控篇 Github Link: https://github.com/panjianlong13/SpringBoot-SpringCloud/tree/master/spring-cloud-hystrix-monitor 在微服務架構中,根據

史上最簡單的SpringCloud教程 | 第十二篇 斷路器監控(Hystrix Dashboard)

詳細 pre 良好的 依次 alt ews 需要 ext 數據監控 最新Finchley版本,請訪問:https://www.fangzhipeng.com/springcloud/2018/08/30/sc-f12-dash/或者http://blog.csdn.net

SpringCloud-熔斷監控Hystrix Dashboard

Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請求成功率等資料。 新增如下依賴 <dependency>

Spring Cloud | 第 斷路器監控(Hystrix Dashboard)以及碰到的問題

一:Hystrix Dashboard簡介在微服務架構中為例保證程式的可用性,防止程式出錯導致網路阻塞,出現了斷路器模型。斷路器的狀況反應了一個程式的可用性和健壯性,它是一個重要指標。Hystrix Dashboard是作為斷路器狀態的一個元件,提供了資料監控和友好的圖形化介

基於Hystrix DashboardTurbine構建服務監控(SpringBoot 2.0.x)

前言 最近這段時間想把叢集的監控搭起來,總是不成功,最後發現是SpringBoot版本不相容導致的。本文將介紹基於SpringBoot 2.0.x的 Dashboard,Turbine構建服務監控中遇到的問題和經驗,並以對Zuul的監控為例搭建簡單的的服務監控。 服務搭建 版

Spring Cloud(七)Hystrix DashboardTurbine服務監控

文章目錄 1 Hystrix Dashboard案例 1.1 增加依賴 1.2 編寫啟動類 1.3 測試 1.4 監控 2 Hystrix Dashboard Turbine案例 2.1 建立Hy

第四章、spring cloud---熔斷監控Hystrix+Dashboard+Turbine+security

Hystrix+Dashboard+Turbine+security整合 Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請求成功率等資料。

springcloud(六)熔斷監控Turbine

在複雜的分散式系統中,相同服務的節點經常需要部署上百甚至上千個,很多時候,運維人員希望能夠把相同服務的節點狀態以一個整體叢集的形式展現出來,這樣可以更好的把握整個系統的狀態。 為此,Netflix提供了一個開源專案(Turbine)來提供把多個hystrix.stream的內容聚合為一個數據源供Dashboa

10.Spring-Cloud-Hystrix熔斷監控Hystrix Dashboard單個應用

SpringCloud完美的整合Hystrix-dashboard,Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請求成功率等資料。可以

Spring Boot + Spring Cloud 構建微服務系統(熔斷監控面板(Hystrix Dashboard

Hystrix Dashboard Hystrix-dashboard是一款針對Hystrix進行實時監控的工具,通過Hystrix Dashboard我們可以在直觀地看到各Hystrix Command的請求響應時間, 請求成功率等資料。 新增依賴 我們新建一個工程 spring-cloud-consul-

SpringCloud之斷路器監控(Hystrix Dashboard)

Hystrix Dashboard簡介 在微服務架構中為例保證程式的可用性,防止程式出錯導致網路阻塞,出現了斷路器模型。斷路器的狀況反應了一個程式的可用性和健壯性,它是一個重要指標。Hystrix Dashboard是一款針對Hystrix進行實時監控的圖形化介面工具,通過Hystr