turbine是聚合服務器發送事件流數據的一個工具,hystrix的監控中,只能監控單個節點,實際生產中都爲集羣,所以能夠經過 turbine來監控集羣下hystrix的metrics狀況,經過eureka來發現hystrix服務。
一、jar包pom.xmlhtml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>java <artifactId>love-life-turbine</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging>web <name>love-life-turbine</name>spring <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.5.RELEASE</version> </parent>apache <properties> <start-class>com.love.life.turbine.boot.TurbineApplication</start-class> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.8</java.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Brixton.SR3</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- eureka依賴 --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> </dependency> <!-- hystrix依賴 --> <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> <!-- turnbine依賴 --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-turbine</artifactId> </dependency> </dependencies>服務器 <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>app </project> dom |
二、在application.yml配置maven
--- spring: rabbitmq: host: localhost port: 5672 username: zhb password: zhb virtual-host: cloud-zhb eureka: instance: preferIpAddress: true statusPageUrlPath: /info.html client: serviceUrl: defaultZone: http://localhost:8761/eureka/ turbine: appConfig: love-origami-domain,cloud-cust-domain,love-life-app aggregator: clusterConfig: MAIN clusterNameExpression: metadata['cluster'] |
三、啓動程序配置spring-boot
package com.love.life.turbine.boot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; import org.springframework.cloud.netflix.turbine.EnableTurbine; import org.springframework.context.annotation.Bean; /** * 項目的啓動類,指定掃描的包路徑 * @author itw_huomb */ @EnableTurbine @EnableHystrixDashboard @SpringBootApplication @EnableEurekaClient public class TurbineApplication { public static void main(String[] args) { SpringApplication.run(TurbineApplication.class, args); } } 四、在被監控的服務application.yml中的euraka服務器配置爲,紅色爲增添的內容
eureka: instance: preferIpAddress: true statusPageUrlPath: /info.html metadata-map: cluster: MAIN |
五、打開地址輸入
|

七、在各客戶端應用的服務端的斷路器配置處