当前服务实例的监控状况,让这个监控的数据可视化,他往往是集群部署的,单个实例的话意义不大,
Turbine他可以做监控数据的聚合,他可以监控整个集群
https://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/2.1.0.M3/single/
spring-cloud-netflix.html#_turbine
5.2 Turbine
他不是一个从无到有的过程,他已经是一个特殊状况了,所以我就不按照文档进行讲解了
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-hystrix
localhost:8010/movie/1
localhost:8031/turbine.stream?cluster=test
https://blog.csdn.net/liaokailin/article/details/51344281
localhost:8030/hystrix
https://www.jianshu.com/p/5a5edd323506
turbine是监控整个集群的,turbine从eurka获取多个节点本来就是有延迟的,所以是准实时的监控结果,有一定的延迟,
断路器的状态是关闭的,这个他可以捕获到,查看个别实例,Hystrix查的是单个实例,集群环境下有什么用呢,意义不大,
它是一个应用,他可以聚合,聚合到一个turbine stream,访问turbine.stream,组合的数据,可以放到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#_turbine
By 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-turbine
turbine.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);
}
}