Turbine聚合监控

一、搭建监控模块

1. 创建监控模块

创建hystrix-monitor模块,使用Turbine聚合监控多个Hystrix dashboard功能,

2. 引入Turbine聚合监控起步依赖

<?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"><parent><artifactId>hystrix-parent</artifactId><groupId>com.itheima</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>hystrix-monitor</artifactId><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-netflix-hystrix-dashboard</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-turbine</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-eureka-client</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>

3. 修改application.yml

spring:application.name: hystrix-monitor
server:port: 8769
turbine:combine-host-port: true# 配置需要监控的服务名称列表app-config: hystrix-provider,hystrix-consumercluster-name-expression: "'default'"aggregator:cluster-config: default#instanceUrlSuffix: /actuator/hystrix.stream
eureka:client:serviceUrl:defaultZone: http://localhost:8761/eureka/

4. 创建启动类

@SpringBootApplication
@EnableEurekaClient@EnableTurbine //开启Turbine 很聚合监控功能
@EnableHystrixDashboard //开启Hystrix仪表盘监控功能
public class HystrixMonitorApp {public static void main(String[] args) {SpringApplication.run(HystrixMonitorApp.class, args);}}

二、修改被监控模块

需要分别修改 hystrix-provider 和 hystrix-consumer 模块:

1、导入依赖:

     <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-hystrix</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId></dependency>

2、配置Bean

此处为了方便,将其配置在启动类中。

@Beanpublic ServletRegistrationBean getServlet() {HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);registrationBean.setLoadOnStartup(1);registrationBean.addUrlMappings("/actuator/hystrix.stream");registrationBean.setName("HystrixMetricsStreamServlet");return registrationBean;}

3、启动类上添加注解@EnableHystrixDashboard

@EnableDiscoveryClient
@EnableEurekaClient
@SpringBootApplication
@EnableFeignClients
@EnableHystrixDashboard // 开启Hystrix仪表盘监控功能
public class ConsumerApp {public static void main(String[] args) {SpringApplication.run(ConsumerApp.class,args);}@Beanpublic ServletRegistrationBean getServlet() {HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);registrationBean.setLoadOnStartup(1);registrationBean.addUrlMappings("/actuator/hystrix.stream");registrationBean.setName("HystrixMetricsStreamServlet");return registrationBean;}
}

三、启动测试

1、启动服务:

  • eureka-server

  • hystrix-provider

  • hystrix-consumer

  • hystrix-monitor

2、访问:

在浏览器访问http://localhost:8769/hystrix/ 进入Hystrix Dashboard界面

界面中输入监控的Url地址 http://localhost:8769/turbine.stream,监控时间间隔2000毫秒和title,如下图

  • 实心圆:它有颜色和大小之分,分别代表实例的监控程度和流量大小。如上图所示,它的健康度从绿色、黄色、橙色、红色递减。通过该实心圆的展示,我们就可以在大量的实例中快速的发现故障实例和高压力实例。
  • 曲线:用来记录 2 分钟内流量的相对变化,我们可以通过它来观察到流量的上升和下降趋势。

Turbine聚合监控相关推荐

  1. SpringCloud系列七:Hystrix 熔断机制(Hystrix基本配置、服务降级、HystrixDashboard服务监控、Turbine聚合监控)...

    声明:本文来源于MLDN培训视频的课堂笔记,写在这里只是为了方便查阅. 1.概念:Hystrix 熔断机制 2.具体内容 所谓的熔断机制和日常生活中见到电路保险丝是非常相似的,当出现了问题之后,保险丝 ...

  2. SpringCloud:Hystrix 熔断机制(基本配置、服务降级、HystrixDashboard服务监控、Turbine聚合监控)

    所谓的熔断机制和日常生活中见到电路保险丝是非常相似的,当出现了问题之后,保险丝会自动烧断,以保护我们的电器, 那么如果换到了程序之中呢?当现在服务的提供方出现了问题之后整个的程序将出现错误的信息显示, ...

  3. SpringCloud配置之:Turbine聚合监控

    Turbine聚合监控 一.搭建监控模块 1. 创建监控模块 创建hystrix-monitor模块,使用Turbine聚合监控多个Hystrix dashboard功能, 2. 引入Turbine聚 ...

  4. 使用Turbine聚合监控

    Turbine概述 Turbine真正做的,就是将每一个(指定)服务的Hystrix/stream中的状态信息取出,并集中处理(计算与展示),应该说,它是具有自己独立的调度的,服务(实例)发现,服务连 ...

  5. Hystrix Turbine聚合监控

    之前,我们针对的是一个微服务实例的Hystrix数据查询分析,在微服务架构下,一个微服务的实例往往是多个(集群化). 比如自动投递微服务 实例1(hystrix) ip1:port1/actuator ...

  6. 使用Turbine聚合监控数据

    一.使用Turbine聚合监控数据 使用/hystrix.stream端点监控单个微服务实例.然而,使用微服务架构的应用系统一般会包含若干微服务,每个微服务通常都会部署多个实例.如果每次只能查看单个实 ...

  7. 使用 Turbine 聚合监控

    在使用 Hystrix Dashboard 组件监控服务的熔断状况时,每个服务都有一个 Hystrix Dashboard 主页,当服务数量很多时相当不方便.为了同时监控多个服务的熔断器的状态,可以使 ...

  8. spring cloud之Turbine断路器聚合监控(十二)

    一.博客背景 上一章讲解了针对一个微服务的断路器监控,但是微服务通常会是多个实例组成的一个集群. 倘若集群里的实例比较多,难道要挨个挨个去监控这些实例吗? 何况有时候,根据集群的需要,会动态增加或者减 ...

  9. turbine 集群聚合监控

    目录 一.turbine介绍 二.turbine配置 1.当前项目环境说明 2.turbine环境配置 (1)创建项目 (2)编辑pom (3)编辑yml (4)编辑主程序 (5)测试集群监控 3.项 ...

最新文章

  1. css 样式使用方法的累积
  2. 简单的总是好的,在这个复杂的世界: java simple log
  3. python堆堆乐教程_python堆排序,详细过程图和讲解,这样做小白都会
  4. Linux操作系统中内存buffer和cache的区别--从free命令说起(转)
  5. 雷军:如果程序人生的话,这条路太漫长
  6. 为什么敏捷开发在亚洲实行不了
  7. .NET 6新特性试用 | 文件范围的命名空间
  8. Ubuntu 12.04 Server OpenStack Havana多节点(OVS+GRE)安装
  9. ICCV2021 |上交、北理、百度联合研究视频缩放任务中的自条件概率学习
  10. 调查了 2 万多名 Python 开发者,有了这些发现!
  11. poj 1330(LCA)
  12. [转]大量正版软件下载链接
  13. 2001年广西壮族自治区植被类型分布数据
  14. 原型图APP尺寸大小
  15. python车牌识别(包括SVM原理)
  16. Unity微信Android端第三方登陆
  17. tplink 2.4g弱信号剔除_路由器信号分为2.4G和5G,这两种信号有什么区别
  18. python杨辉三角函数_python杨辉三角输出指定行_使用python打印十行杨辉三角过程详解...
  19. MYSQL 时间格式化
  20. 如何提炼好的软文标题

热门文章

  1. Oracle rac 日常维护
  2. Custom elements in iteration require ‘v-bind:key‘ directives vue/valid-v-for
  3. csv逗号分割不兼容 解决_关于Excel保存为csv文件时提示 “可能含有与CSV(逗号分隔)不兼容的功能”...
  4. ffmepg.exe使用的例子
  5. 如何用easyui在页面上实现分页操作
  6. Odp.Net 连接Oracle
  7. 「征文」使用极光遇到过的那些事
  8. 一个AJAX调用方面的问题
  9. 绑定对话框和选项按钮
  10. office 2016 如何查看/删除/更新密钥序列号?