上一篇利用Hystrix Dashboard去监控断路器的Hystrix command,当我们有很多服务的时候,就需要聚合所有服务的Hystrix Dashboard数据了,这就需要Hystrix Turbine了。

Hystrix Turbine

  看单个的Hystrix Dashboard的数据并没有什么多大的价值,要想看这个系统的Hystrix Dashboard数据就需要用到Hystrix Turbine。Hystrix Turbine将每个服务HystrixDashboard数据进行整合。Hystrix Turbine的使用非常简单,只需要引入响应的依赖和加上注解和配置就可以了。

第一种方式:通过Http收集聚合

创建一个spring boot项目,命名为david-turbine

pom.xml

<?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> <groupId>com.david</groupId>
<artifactId>turbine</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>turbine</name>
<description>Demo project for Spring Boot</description> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</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.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies> <dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Edgware.SR2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> </project>

启动类中使用@EnableTurbine开启Turbine

@EnableTurbine
@SpringBootApplication
public class TurbineApplication { public static void main(String[] args) {
SpringApplication.run(TurbineApplication.class, args);
}
}

application.yml

spring:
application:
name: david-turbine
server:
port: 8769
security:
basic:
enabled: false
turbine:
aggregator:
cluster-config: default #指定聚合哪些集群,多个使用 , 分割 默认为default
app-config: DAVID-EUREKA-CLIENT,DAVID-FEIGN,DAVID-RIBBON #配置Eureka中的serviceId列表,表明监控哪些服务
cluster-name-expression: new String("default")
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka/

依次启动项目:

在浏览器输入 http://localhost:8769/turbine.stream

打开:http://localhost:8762/hystrix,输入监控流http://localhost:8769/turbine.stream 确定

Spring Cloud (11) Hystrix-监控聚合监控的更多相关文章

  1. Spring Cloud中Hystrix、Ribbon及Feign的熔断关系是什么?

    导读 今天和大家聊一聊在Spring Cloud微服务框架实践中,比较核心但是又很容易把人搞得稀里糊涂的一个问题,那就是在Spring Cloud中Hystrix.Ribbon以及Feign它们三者之 ...

  2. Spring Cloud中Hystrix 线程隔离导致ThreadLocal数据丢失问题分析

    最近spring boot项目中由于使用了spring cloud 的hystrix 导致了threadLocal中数据丢失,其实具体也没有使用hystrix,但是显示的把他打开了,导致了此问题. 导 ...

  3. 从零开始学spring cloud(十一) -------- hystrix监控

    一.官方文档阅读 服务启动后,可以通过/health和hystrix.stream查看效果,实际上,访问上述两个地址,会出现404,这是因为spring boot版本的问题, 我在这里使用的sprin ...

  4. spring cloud深入学习(六)-----熔断监控Hystrix Dashboard和Turbine

    Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数 ...

  5. Spring Cloud(五)断路器监控(Hystrix Dashboard)

    在上两篇文章中讲了,服务提供者 Eureka + 服务消费者 Feign,服务提供者 Eureka + 服务消费者(rest + Ribbon),本篇文章结合,上两篇文章中代码进行修改加入 断路器监控 ...

  6. Spring Cloud :断路器集群监控(Turbine)

    一. 简介      上一篇文章我们已经实现了对单个服务实例的监控,当然在实际应用中,单个实例的监控数据没有多大的价值,我们更需要的是一个集群系统的监控信息,这时我们就需要引入Turbine.Turb ...

  7. springboot hystrix turbine 聚合监控

    1.新建Module  eureka-monitor-client 2.父级pom中添加module 3.编写eureka-monitor-client 中的pom <?xml version= ...

  8. Spring Cloud(三) --- hystrix

    Hystrix 说到Hystrix就得先说一下产生的背景等等,那就是雪崩效应. 在微服务中肯定存在多个服务层之间的调用,基础服务的故障可能会导致级联故障,进而造成整个系统不可用的情况,这种现象被称为服 ...

  9. Spring Cloud断路器Hystrix

    在微服务架构中,存在着那么多的服务单元,若一个单元出现故障,就会因依赖关系形成故障蔓延,最终导致整个系统的瘫痪,这样的架构相较传统架构就更加的不稳定.为了解决这样的问题,因此产生了断路器模式. 什么是 ...

随机推荐

  1. hihocoder 1032 最长回文子串(Manacher)

    传送门 #include<queue> #include<cmath> #include<cstdio> #include<cstring> #incl ...

  2. No buffer space available错误解决方案

    生产环境,突然爆发问题,网络正常,但是报网络不通错误,重启tomcat立刻好使 开始以为是tomcat的问题,调查了很久,后来加上堆栈日志才发现 简单来说,就是1-4分钟之内,使用了大量的http请求 ...

  3. Java Web学习总结(31)——全站HTTPS化SSL免费证书使用

    1 背景 谷歌从 2017 年起,Chrome 浏览器将也会把采用 HTTP 协议的网站标记为「不安全」网站:苹果从 2017 年 iOS App 将强制使用 HTTPS:在国内热火朝天的小程序也要求 ...

  4. hammerjs & Swiper & touch & gesture

    hammerjs https://hammerjs.github.io/getting-started/ http://hammerjs.github.io/recognizer-swipe/ Swi ...

  5. 洛谷—— P2049 魔术棋子

    https://www.luogu.org/problem/show?pid=2049 题目描述 在一个M*N的魔术棋盘中,每个格子中均有一个整数,当棋子走进这个格子中,则此棋子上的数会被乘以此格子中 ...

  6. RAR5格式不同词典大小下压缩率的简单测试

    一个VMWare虚拟机安装Win7后的磁盘文件进行压缩,已经进行了清理处理,原始大小为12.1GB 词典大小  压缩后大小  压缩比率 32MB 4.08GB 33.7% 256MB 3.88GB 3 ...

  7. Android开发系列(二十四):Notification的功能与使用方法

    关于消息的提示有两种:一种是Toast,一种就是Notification.前者维持的时间比較短暂.后者维持的时间比較长. 并且我们寻常手机的应用比方网易.贴吧等等都有非常多的推送消息,就是用Notif ...

  8. 在Ubuntu平台上创建Cordova Camera HTML5应用

    在这篇文章中,我们将具体介绍怎样使用Cordova Camera HTML5 应用.很多其它关于Cordova的开发指南,开发人员能够參考文章"the Cordova Guide" ...

  9. JWPlayer Uncaught Error: Invalid SRT file

    错误场景: JWPlayer 播放视频,加入了字幕和缩略图: 字幕为Srt格式: 1 00:00:00,000 --> 00:00:02,000 战略管理过程 2 00:00:03,000 -- ...

  10. JavaSE入门学习12: Java面相对象之static使用方法

    我们能够基于一个类创建多个该类的对象,每一个对象都拥有自己的成员,互相独立. 然而在某些时候,我们更希 望该类全部的对象共享同一个成员. 此时就是static大显身手的时候了. Java中被stati ...