Turbine
當前服務實例的監(jiān)控狀況,讓這個監(jiān)控的數(shù)據(jù)可視化,他往往是集群部署的,單個實例的話意義不大,Turbine他可以做監(jiān)控數(shù)據(jù)的聚合,他可以監(jiān)控整個集群https://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/2.1.0.M3/single/
spring-cloud-netflix.html#_turbine5.2 Turbine他不是一個從無到有的過程,他已經(jīng)是一個特殊狀況了,所以我就不按照文檔進行講解了Spring Cloud provides a spring-cloud-starter-netflix-turbine that has all the dependencies you need to get a Turbine server running. To ad Turnbine, create a Spring Boot application and annotate it with @EnableTurbine.你要寫一個turbine server的話,加上這個就包括了一切依賴,turbine需要注冊到eureka上面去localhost:8031/turbine.stream?cluster=microservice-consumer-movie-ribbon-hystrixlocalhost:8010/movie/1localhost:8031/turbine.stream?cluster=testhttps://blog.csdn.net/liaokailin/article/details/51344281localhost:8030/hystrixhttps://www.jianshu.com/p/5a5edd323506turbine是監(jiān)控整個集群的,turbine從eurka獲取多個節(jié)點本來就是有延遲的,所以是準實時的監(jiān)控結(jié)果,有一定的延遲,斷路器的狀態(tài)是關(guān)閉的,這個他可以捕獲到,查看個別實例,Hystrix查的是單個實例,集群環(huán)境下有什么用呢,意義不大,它是一個應用,他可以聚合,聚合到一個turbine stream,訪問turbine.stream,組合的數(shù)據(jù),可以放到hystrix dashboard里面去用,其實可以通過Eureka去定位到某個實例的,他說我這個東西怎么用呢,加上依賴Looking at an individual instance’s Hystrix data is not very useful in terms of the overall health of the system. Turbine is an application that aggregates all of the relevant /hystrix.stream endpoints into a combined /turbine.stream for use in the Hystrix Dashboard. Individual instances are located through Eureka. Running Turbine requires annotating your main class with the @EnableTurbine annotation (for example, by using spring-cloud-starter-netflix-turbine to set up the classpath). All of the documented configuration properties from the Turbine 1 wiki apply. The only difference is that the turbine.instanceUrlSuffix does not need the port prepended, as this is handled automatically unless turbine.instanceInsertPort=false.它會看每一個hystrix.stream這個終端https://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/2.1.0.M3/single/
spring-cloud-netflix.html#_turbineBy default, Turbine looks for the /hystrix.stream endpoint on a registered instance by looking up its hostName and port entries in Eureka and then appending /hystrix.stream to it. If the instance’s metadata contains management.port, it is used instead of the port value for the /hystrix.stream endpoint. By default, the metadata entry called management.port is equal to the management.port configuration property. It can be overridden though with following configuration:/*** Gets the relative home page URL Path for this instance. The home page URL is then* constructed out of the hostName and the type of communication - secure or unsecure.** It is normally used for informational purposes for other services to use it as a* landing page.*/
private String homePageUrlPath = "/";默認是/org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean.statusPageUrl
<?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><artifactId>microservice-hystrix-turbine</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><name>microservice-hystrix-turbine</name><description>Demo project for Spring Boot</description><parent><groupId>cn.learn</groupId><artifactId>microcloud02</artifactId><version>0.0.1</version></parent><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><java.version>1.8</java.version></properties><dependencies><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></project>
server.port=8031
eureka.client.serviceUrl.defaultZone=http://admin:1234@10.40.8.152:8761/eureka
spring.application.name=microservice-hystrix-turbine
eureka.instance.prefer-ip-address=true
eureka.instance.instance-id=${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}
spring.redis.host=10.40.8.152
eureka.instance.appname=microservice-hystrix-turbineturbine.appConfig=microservice-consumer-movie-ribbon-hystrix
turbine.aggregator.clusterConfig=test
package com.learn.cloud;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.turbine.EnableTurbine;@SpringBootApplication
@EnableTurbine
public class TurbineApplication {public static void main(String[] args) {SpringApplication.run(TurbineApplication.class, args);}
}
?
總結(jié)
- 上一篇: Hystrix Dashboard的使用
- 下一篇: API Gateway简介