集群监控 java,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依赖

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

org.springframework.boot

spring-boot-starter-parent

1.5.9.RELEASE

spring-cloud-hystrix-turbine

org.springframework.boot

spring-boot-starter-web

org.springframework.cloud

spring-cloud-starter-consul-discovery

org.springframework.cloud

spring-cloud-starter-consul-config

org.springframework.cloud

spring-cloud-starter-hystrix

org.springframework.cloud

spring-cloud-starter-hystrix-dashboard

org.springframework.boot

spring-boot-starter-actuator

org.springframework.cloud

spring-cloud-starter-netflix-turbine

org.springframework.cloud

spring-cloud-starter-netflix-eureka-client

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工程。

hystrix断路器生效。

打开:http://localhost:8810/hystrix/,输入监控流http://localhost:8810/turbine.stream

d8c34d24aec1f31591a7943086cc138c.png

点击monitor stream 进入页面:

daaf3c1aeba6e1c437a367986a6f98ed.png

可以看到这个页面聚合了2个service的hystrix dashbord数据。

参数详解

OK,仪表盘已经显示出来了,那么仪表盘上的各项数据都是什么意思呢?我们来看下面一张图:

a83bf1e30e45d285bf078dd84ff379ea.png

https://www.cnblogs.com/linjiqin/category/1301747.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值