史上最简单的SpringCloud教程 | 第十三篇: 断路器聚合监控(Hystrix Turbine)
转:https://blog.csdn.net/forezp/article/details/70233227
上一篇文章讲述了如何利用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,所以需要再建一个服务,取名为service-lucy,它的基本配置同service-hi,具体见源码(https://github.com/forezp/SpringCloudLearning/tree/master/chapter13),在这里就不详细说明。
三、创建service-turbine
引入相应的依赖:
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-turbine</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-netflix-turbine</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies>
在其入口类ServiceTurbineApplication加上注解@EnableTurbine,开启turbine,@EnableTurbine注解包含了@EnableDiscoveryClient注解,即开启了注册服务。
@SpringBootApplication
@EnableTurbine
public class ServiceTurbineApplication {public static void main(String[] args) {new SpringApplicationBuilder(ServiceTurbineApplication.class).web(true).run(args);}
}
配置文件application.yml:
spring:application.name: service-turbine
server:port: 8769
security.basic.enabled: false
turbine:aggregator:clusterConfig: default # 指定聚合哪些集群,多个使用","分割,默认为default。可使用http://.../turbine.stream?cluster={clusterConfig之一}访问appConfig: service-hi,service-lucy ### 配置Eureka中的serviceId列表,表明监控哪些服务clusterNameExpression: new String("default")# 1. clusterNameExpression指定集群名称,默认表达式appName;此时:turbine.aggregator.clusterConfig需要配置想要监控的应用名称# 2. 当clusterNameExpression: default时,turbine.aggregator.clusterConfig可以不写,因为默认就是default# 3. 当clusterNameExpression: metadata['cluster']时,假设想要监控的应用配置了eureka.instance.metadata-map.cluster: ABC,则需要配置,同时turbine.aggregator.clusterConfig: ABC
eureka:client:serviceUrl:defaultZone: http://localhost:8761/eureka/
配置文件注解写的很清楚。
四、Turbine演示
依次开启eureka-server、service-hi、service-lucy、service-turbine工程。
打开浏览器输入:http://localhost:8769/turbine.stream,界面如下:
依次请求:
http://localhost:8762/hi?name=forezphttp://localhost:8763/hi?name=forezp
打开:http://localhost:8763/hystrix,输入监控流http://localhost:8769/turbine.stream
点击monitor stream 进入页面:
可以看到这个页面聚合了2个service的hystrix dashbord数据。
源码下载:
https://github.com/forezp/SpringCloudLearning/tree/master/chapter13
五、参考文献
hystrix_dashboard : http://projects.spring.io/spring-cloud/spring-cloud.html#_circuit_breaker_hystrix_dashboard
turbine :http://projects.spring.io/spring-cloud/spring-cloud.html#_turbine
史上最简单的SpringCloud教程 | 第十三篇: 断路器聚合监控(Hystrix Turbine)相关推荐
- 史上最简单的SpringCloud教程 | 第四篇:断路器(Hystrix)
转:https://blog.csdn.net/forezp/article/details/69934399 最新版本: 史上最简单的SpringCloud教程 | 第四篇:断路器(Hystrix) ...
- 史上最简单的SpringCloud教程 | 第四篇:断路器(Hystrix)--有BUG,注意看我的备注
转载请标明出处: http://blog.csdn.net/forezp/article/details/69934399 本文出自方志朋的博客 在微服务架构中,根据业务来拆分成一个个的服务,服务 ...
- 史上最简单的SpringCloud教程 | 第四篇:断路器(Hystrix)--里面有BUG,所以我转载改一下
017年04月09日 21:14:05 阅读数:271535 转载请标明出处: http://blog.csdn.net/forezp/article/details/69934399 本文出自方 ...
- 史上最简单的SpringCloud教程 | 第四篇:断路器(Hystrix)(Finchley版本)
转载请标明出处: http://blog.csdn.net/forezp/article/details/81040990 本文出自方志朋的博客 个人博客纯净版:https://www.fangzhi ...
- 史上最简单的 SpringCloud 教程 | 第一篇: 服务的注册与发现(Eureka)
最新Finchley版本请访问: https://www.fangzhipeng.com/springcloud/2018/08/30/sc-f1-eureka/ 或者 http://blog.csd ...
- 史上最简单的SpringCloud教程 | 第六篇: 分布式配置中心(Spring Cloud Config)
转:https://blog.csdn.net/forezp/article/details/70037291 最新版本: 史上最简单的SpringCloud教程 | 第六篇: 分布式配置中心(Spr ...
- 史上最简单的SpringCloud教程 | 第五篇: 路由网关(zuul)
转:https://blog.csdn.net/forezp/article/details/69939114 最新版本: 史上最简单的SpringCloud教程 | 第五篇: 路由网关(zuul)( ...
- 史上最简单的SpringCloud教程 | 第三篇: 服务消费者(Feign)
转:https://blog.csdn.net/forezp/article/details/69808079 最新版本: 史上最简单的SpringCloud教程 | 第三篇: 服务消费者(Feign ...
- 史上最简单的SpringCloud教程 | 第七篇: 高可用的分布式配置中心(Spring Cloud Config)(Finchley版本)
转载请标明出处: http://blog.csdn.net/forezp/article/details/81041045 本文出自方志朋的博客 个人博客纯净版:https://www.fangzhi ...
最新文章
- 逆向工程破解苹果监控iPhone图片的算法:原来iOS14.3上就有了
- 高并发下缓存与数据库双写不一致解决方案
- python 余弦距离_距离公式汇总以及Python实现
- 天锋w2019_不知道为什么那么多人喜欢三星W2019,直到入手这款天锋W2019手机
- 提取特征点的方式,opencv2.x和opencv3.x的区别
- Atitit ocr的艺术 艾提拉著 目录 1. OCR可以说是一门非常“古老”的技术,在上世纪50年代到90年代,	1 1.1. 场景文字识别技术(Scene Text Recognition,
- 我是一只IT小小鸟(转载)
- 如何进入ThinkSystem系列服务器SAS RAID阵列配置界面
- Microsoft Edge浏览器兼容性问题解决方法
- 如何更好的使用谷歌搜索引擎
- idea-2017破解教程
- javasprit基础用法
- 8583 报文解析过程
- 全球及中国3,4-二氯异噻唑-5-羧酸行业研究及十四五规划分析报告
- discuz nt mysql_discuz x2 mysql 数据库 表结构
- 单相逆变电路实战!(基于STM32F103C8T6的单相逆变电路,PID控制输出额定电压)
- Go语言 rand(随机数)包
- 代理服务器、虚拟专用网络、网关
- 所有的Python “爬虫“ 初学者,都应该看这篇文章!
- gm修改爆率需要重启服务器吗,传奇GM教程 传奇私服如何调整爆率
热门文章
- 我的第一个微信好友分析
- Django框架(4.django中进入项目的shell之后对数据表进行增删改查的操作)
- Python多任务(7.多进程的应用:文件的拷贝器例子)
- 用图讲解狄克斯特拉(DiskStra)算法,python实现 。
- python +keras实现图像分类(入门级例子讲解)
- opengl加载显示3D模型nff类型文件
- wxWidgets:wxVariantDataCurrency类用法
- wxWidgets:wxToolBar类用法
- boost::timer::auto_cpu_timer相关的测试程序
- boost::locale::calendar用法的测试程序