Turbine——Hystrix集群监控
上一篇文章讲述了如何利用Hystrix Dashboard去监控断路器的Hystrix command。当我们有很多个服务的时候,这就需要聚合所有服务的Hystrix Dashboard的数据了。这就需要用到Spring Cloud的另一个组件了,即Hystrix Turbine。
一、Hystrix Turbine简介
看单个的Hystrix Dashboard的数据并没有什么多大的价值,要想看多个系统或集群系统的Hystrix Dashboard数据就需要用到Hystrix Turbine。Hystrix Turbine将每个服务Hystrix Dashboard数据进行了整合。Hystrix Turbine的使用非常简单,只需要引入相应的依赖和加上注解和配置就可以了。
二、准备工作
因为我们需要监控多个服务的Dashboard,所以需要搭建一个Turbine服务来聚合监控 Hystrix 断路器,取名为spring-cloud-hystrix-turbine。
三、创建spring-cloud-hystrix-turbine
1、引入pom依赖
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<artifactId>spring-cloud-hystrix-turbine</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-config</artifactId>
</dependency>
<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>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-turbine</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
2、配置文件application.yml
spring:
application:
name: spring-cloud-hystrix-turbine
cloud:
consul:
discovery:
prefer-ip-address: true
instanceId: ${spring.application.name}:${server.port}
host: localhost
port: 8500
server:
port: 8810
turbine:
aggregator:
#监控所有微服务集群
#hytrix仪表盘:http://localhost:8810/hystrix/
#监控地址:http://localhost:8810/turbine.stream
#在hystrix仪表盘中监控上面的地址即可
clusterConfig: default
#要监控的微服务serviceId
appConfig: mcc-feign-hystrix,mcc-ribbon-hystrix,mcc-ribbon-hystrix-propagating
clusterNameExpression: "'default'"
3、TurbineApplication——Turbine入口程序
package com.lynch.consumer.turbine; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine; @SpringBootApplication
//开启Turbine支持,用来进行集群监控
@EnableTurbine
//开启Hystrix仪表盘
@EnableHystrixDashboard
public class TurbineApplication {
public static void main(String[] args) {
SpringApplication.run(TurbineApplication.class, args);
}
}
四、Turbine演示
依次开启mcc-feign-hystrix、mcc-ribbon-hystrix、mcc-ribbon-hystrix-propagating、spring-cloud-hystrix-turbine工程。
打开浏览器输入:http://localhost:8810/turbine.stream,界面如下:
依次多次请求:
http://localhost:8807/ribbon/get/aa
http://localhost:8808/feign1/get/aa
hystrix断路器生效。
打开:http://localhost:8810/hystrix/,输入监控流http://localhost:8810/turbine.stream
点击monitor stream 进入页面:
可以看到这个页面聚合了2个service的hystrix dashbord数据。
参数详解
OK,仪表盘已经显示出来了,那么仪表盘上的各项数据都是什么意思呢?我们来看下面一张图:
Turbine——Hystrix集群监控的更多相关文章
- Spring Cloud第八篇 | Hystrix集群监控Turbine
本文是Spring Cloud专栏的第八篇文章,了解前七篇文章内容有助于更好的理解本文: Spring Cloud第一篇 | Spring Cloud前言及其常用组件介绍概览 Spring Clo ...
- SpringCloud2.0 Turbine 断路器集群监控 基础教程(九)
1.启动基础工程 1.1.启动[服务中心]集群,工程名称:springcloud-eureka-server 参考 SpringCloud2.0 Eureka Server 服务中心 基础教程(二) ...
- SpringCloud之Hystrix集群监控turbine仪表盘
1.引入 在前一节中我们演示了单机模式下Hystrix服务监控Dashboard仪表盘,但是在实际生产中微服务都是集群模式, 为了更接近世界生产,我们在这里也给大家讲一下如何监控集群模式 2.准备工作 ...
- 改造断路器集群监控Hystrix Turbine实现自动注册消费者、实时监控多个服务
在上一篇文章中,我们搭建了Hystrix Dashoard,对指定接口进行监控.但是只能对一个接口进行监听,功能比较局限: Turbine:汇总系统内多个服务的数据并显示到 Hystrix Dashb ...
- 服务容错保护断路器Hystrix之四:断路器监控(Hystrix Dashboard)-turbine集群监控
turbine 英[ˈtɜ:baɪn] n. 汽轮机; 涡轮机; 透平机; OK,上文我们看了一个监控单体应用的例子,在实际应用中,我们要监控的应用往往是一个集群,这个时候我们就得采取Turbine集 ...
- 断路器Hystrix与Turbine集群监控-Spring Cloud学习第三天(非原创)
文章大纲 一.Hystrix基础介绍二.断路器Hystrix简单使用三.自定义Hystrix请求命令四.Hystrix的服务降级与异常处理五.Hystrix的请求缓存与请求合并六.Hystrix仪表盘 ...
- Hystrix集群及集群监控turbine
Hystrix集群及监控turbine 前面Dashboard演示的仅仅是单机服务监控,实际项目基本都是集群,所以这里集群监控用的是turbine. turbine是基于Dashboard的. 先搞个 ...
- Spring Cloud Hystrix Dashboard熔断器-Turbine集群监控(六)
序言 上一篇说啦hystrix的使用方法与配置还有工作流程及为何存在,我去,上一篇这么屌,去看看吧,没这么屌的话,我贴的有官方文档,好好仔细看看 hystrix除啦基本的熔断器功能之外,还可以对接口的 ...
- SpringCloud之Hystrix集群及集群监控turbine
目的: Hystrix集群及监控turbine Feign.Hystrix整合之服务熔断服务降级彻底解耦 集群后超时设置 Hystrix集群及监控turbine 新建一个springboot工程mic ...
随机推荐
- EPEL 源
EPEL/zh-cn Page Discussion View View source History < EPEL In other languages: English (en) e ...
- NC 5导出Excel
Excel导出功能 NC中功能事件代码: @Override protected void onBoRefresh() throws Exception { UIFileChooser fc = ne ...
- python_day8_socket
目录 客户端/服务器架构 socket逻辑结构 socket概念 套接字的概念 TCP与UDP套接字应用 recv与recvfrom的区别 粘包现象及处理 认证客户端的链接合法性 socktserve ...
- vue中鼠标移入字体下面显示颜色并改变字体颜色的问题
<template> <div class="smart_nav" :class="{'fixedTop':fixedTop}"> &l ...
- # 2019-2020-3 《Java 程序设计》第三周总结
2019-2020-3 <Java 程序设计>第三周知识总结 1.类的定义 语法格式如下(加[]表示可选项): [修饰符] class 类名 { 属性定义(声明) 方法定义(声明)} 2. ...
- 顺序队列(C语言)
#define Queue_MAX_SIZE 20 #define OK 1 #define ERROR 0 #include <stdio.h> #include <stdlib. ...
- 说说Runnable与Callable
Callable接口: public interface Callable<V> { V call() throws Exception; } Runnable接口: public int ...
- visual studio 2017使用技巧
visual studio 2017使用技巧 批量删除代码中的空白行 Ctrl + H, 查找: ^(?([^\r\n])\s)*\r?$\r?\n 替换: 使用正则表达式 当前文档 常用快捷键 注释 ...
- 滑块视图容器 swiper
属性名 类型 默认值 说明 indicator-dots Boolean false 是否显示面板指示点 autoplay Boolean false 是否自动切换 current Number 0 ...
- 冲刺博客NO.9
今天做了什么: 看书,看视频学UI设计,尝试设计并美化,然并没有美感,感觉自己设计的界面太丑. 主体进度差不多完成了,美化.