Spring Cloud (11) Hystrix-监控聚合监控
上一篇利用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-监控聚合监控的更多相关文章
- Spring Cloud中Hystrix、Ribbon及Feign的熔断关系是什么?
导读 今天和大家聊一聊在Spring Cloud微服务框架实践中,比较核心但是又很容易把人搞得稀里糊涂的一个问题,那就是在Spring Cloud中Hystrix.Ribbon以及Feign它们三者之 ...
- Spring Cloud中Hystrix 线程隔离导致ThreadLocal数据丢失问题分析
最近spring boot项目中由于使用了spring cloud 的hystrix 导致了threadLocal中数据丢失,其实具体也没有使用hystrix,但是显示的把他打开了,导致了此问题. 导 ...
- 从零开始学spring cloud(十一) -------- hystrix监控
一.官方文档阅读 服务启动后,可以通过/health和hystrix.stream查看效果,实际上,访问上述两个地址,会出现404,这是因为spring boot版本的问题, 我在这里使用的sprin ...
- spring cloud深入学习(六)-----熔断监控Hystrix Dashboard和Turbine
Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数 ...
- Spring Cloud(五)断路器监控(Hystrix Dashboard)
在上两篇文章中讲了,服务提供者 Eureka + 服务消费者 Feign,服务提供者 Eureka + 服务消费者(rest + Ribbon),本篇文章结合,上两篇文章中代码进行修改加入 断路器监控 ...
- Spring Cloud :断路器集群监控(Turbine)
一. 简介 上一篇文章我们已经实现了对单个服务实例的监控,当然在实际应用中,单个实例的监控数据没有多大的价值,我们更需要的是一个集群系统的监控信息,这时我们就需要引入Turbine.Turb ...
- springboot hystrix turbine 聚合监控
1.新建Module eureka-monitor-client 2.父级pom中添加module 3.编写eureka-monitor-client 中的pom <?xml version= ...
- Spring Cloud(三) --- hystrix
Hystrix 说到Hystrix就得先说一下产生的背景等等,那就是雪崩效应. 在微服务中肯定存在多个服务层之间的调用,基础服务的故障可能会导致级联故障,进而造成整个系统不可用的情况,这种现象被称为服 ...
- Spring Cloud断路器Hystrix
在微服务架构中,存在着那么多的服务单元,若一个单元出现故障,就会因依赖关系形成故障蔓延,最终导致整个系统的瘫痪,这样的架构相较传统架构就更加的不稳定.为了解决这样的问题,因此产生了断路器模式. 什么是 ...
随机推荐
- Spring整合Junit框架
一.开发环境 eclipse版本:4.6.1 maven版本:3.3.3 junit版本:4.12 spring版本:4.1.5.RELEASE JDK版本:1.8.0_111 二.项目结构 图 三. ...
- Maven_自动化构建和构建环节
[构建过程的几个主要环节] ①清理:删除以前的编译结果,为重新编译做好准备. ②编译:将 Java 源程序编译为字节码文件. ③测试:针对项目中的关键点进行测试,确保项目在迭代开发过程中关键点的正确性 ...
- Spring MVC概述(2)
1.Spring 为展现层提供基于MVC设计理念的优秀的Web框架,是目前最主流的MVC框架之一. 2.Spring 3.0后全面超越Struts2,成为最优秀的MVC框架. 3.Spring MVC ...
- noip模拟赛 序
[问题背景]zhx 给他的妹子们排序.[问题描述]zhx 有 N 个妹子, 他对第 i 个妹子的好感度为 ai,且所有 ai两两不相等. 现 在 N 个妹子随意站成一排, 他要将她们根据好感度从小到大 ...
- 一文教你用 Neo4j 快速构建明星关系图谱
更多有趣项目及代码见于:DesertsX/gulius-projects 前言 本文将带你用 neo4j 快速实现一个明星关系图谱,因为拖延的缘故,正好赶上又一年的4月1日,于是将文中的几个例子顺势改 ...
- [bzoj2055]80人环游世界[网络流,上下界网络流]
手动画了整张图,,算是搞懂了吧,, #include <bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; templat ...
- 分块试水--CODEVS4927 线段树练习5
模板 #include<stdio.h> #include<algorithm> #include<string.h> #include<stdlib.h&g ...
- POJ2774:Long Long Message
问两个串的最长公共子串,n<=100000. SAM可以直接搞当然SA哈希都可以..类似于KMP的做法,如果沿parent边走要顺势修改匹配位置. #include<stdio.h> ...
- Minimum Transport Cost Floyd 输出最短路
These are N cities in Spring country. Between each pair of cities there may be one transportation tr ...
- mybatis指定jdbctype
MyBatis 插入空值时,需要指定JdbcType mybatis insert空值报空值异常,但是在pl/sql不会提示错误,主要原因是mybatis无法进行转换 所以在MyBatis映射文件中要 ...