SpringCloud入门(六): Hystrix监控
Hystrix.stream 监控
<!--. 配置pom文件,引入actuator包-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency> <!- . 在Spring的启动入口添加@@EnableCircuitBreaker注解->
@SpringBootApplication
@EnableCircuitBreaker
public class EurekaConsumerApplication { public static void main(String[] args) {
SpringApplication.run(EurekaConsumerApplication.class, args);
}
} <!- . 引入HystrixMetricsStreamServlet->
@Configuration
public class HystrixConfig { @Bean
public ServletRegistrationBean getStreamServlet(){
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(); //系统启动时加载顺序
registrationBean.addUrlMappings("/hystrix.stream");//路径
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
}
通过http://localhost:8006/hystrix.stream访问。hystrix.stream界面简洁,但是显示不友好,不方便运维。

Dashboard监控
<!--1. 配置pom文件,引入dashboard包-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency> <!- 2. 在Spring的启动入口添加@EnableHystrixDashboard注解->
@SpringBootApplication
@EnableHystrixDashboard
public class EurekaConsumerApplication { public static void main(String[] args) {
SpringApplication.run(EurekaConsumerApplication.class, args);
}
}
通过http://localhost:8006/hystrix访问。dashboard 只能监控单个服务,对运维人员依旧不友好,只能监控单工程,不能查看历史

集群监控Turbian
<!--1. 配置pom文件,引入dashboard包-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-turbine</artifactId>
</dependency> <!- 2. 配置属性文件->
turbine.aggregator.cluster-config=default
turbine.app-config= ms-provider-order,ms-consumer-user
turbine.cluster-name-expression="'default'"
turbine.instanceUrlSuffix=hystrix.stream <!- 3. YML配置属性文件(只有yml生效,prop配置无效)->
turbine:
aggregator:
clusterConfig: default
appConfig: ms-consumer-user
cluster-name-expression: "'default'"
instanceUrlSuffix: hystrix.stream <!- 4. 在Spring的启动入口添加@EnableHystrixDashboard注解->
@SpringBootApplication
@EnableTurbine
public class EurekaConsumerApplication { public static void main(String[] args) {
SpringApplication.run(EurekaConsumerApplication.class, args);
}
}
通过http://localhost:8006/turbine.stream访问。我们可以通过dashboard对turbine.stream进行监控
备注:1)所有被监控的服务都需要配置Hystrix.stream监控,否则turbine识别不到。
2)instanceUrlSuffix的默认值为:actuator/hystrix.stream;这个属性来自SpringClusterMonitor这个类。如果不配置这个属性会抛出一个MisconfiguredHostException的404异常。
3)在为actuator包指定management.context-path=/xxx属性后也需要对instanceUrlSuffix做变更。


SpringCloud入门(六): Hystrix监控的更多相关文章
- springcloud 入门 11 (Hystrix Dashboard)
hystrix: 断路器我在前面已经介绍,不了解的可以参考 :springcloud 入门 6 (断路器hystrix) 关于搭建,测试我都在这里面进行说明了,这章介绍的是 Hystrix Das ...
- Spring Cloud(六):Hystrix 监控数据聚合 Turbine【Finchley 版】
Spring Cloud(六):Hystrix 监控数据聚合 Turbine[Finchley 版] 发表于 2018-04-17 | 更新于 2018-05-07 | 上一篇我们介绍了使用 H ...
- springcloud(八) Hystrix监控
一.Feign项目Hystrix自带的监控 在feign项目pom.xml 添加: <!-- 1,使用 Hystrix的模块 hystrix-metrics-event-stream,就可将这些 ...
- Spring Cloud 入门 之 Hystrix 篇(四)
原文地址:Spring Cloud 入门 之 Hystrix 篇(四) 博客地址:http://www.extlight.com 一.前言 在微服务应用中,服务存在一定的依赖关系,如果某个目标服务调用 ...
- SpringCloud(2)---SpringCloud入门篇
SpringCloud理解篇 一.微服务概述 1.什么是微服务 目前的微服务并没有一个统一的标准,一般是以业务来划分将传统的一站式应用,拆分成一个个的服务,彻底去耦合,一个微服务就是单功能业务,只做一 ...
- SpringCloud入门(一)
一.微服务概述 1.什么是微服务 目前的微服务并没有一个统一的标准,一般是以业务来划分将传统的一站式应用,拆分成一个个的服务,彻底去耦合,一个微服务就是单功能业务,只做一件事. 与微服务相对的叫巨石 ...
- Spring Cloud(五):Hystrix 监控面板【Finchley 版】
Spring Cloud(五):Hystrix 监控面板[Finchley 版] 发表于 2018-04-16 | 更新于 2018-05-10 | 在上一篇 Hystrix 的介绍中,我们提到 ...
- SpringCloud入门概述
SpringCloud入门概述 Spring的三大模块:SpringBoot(构建),Spring Cloud(协调),Spring Cloud Data Flow(连接)注意:Spring Boot ...
- SpringCloud学习之Hystrix
一.为什么要有断路器 在分布式系统当中,服务之间调用关系会随着业务的发展而变的复杂,一个服务可能依赖多个服务,服务之间层层依赖也是家常便饭的事情,如果一个服务的瘫痪很有可能导致整个系统的崩溃.比如说, ...
随机推荐
- 阿里云zabbix的python脚本
由于阿里云只能用465端口.所以这个zabbix的脚本修改成了465端口的python脚本. 修改于https://www.jianshu.com/p/9d6941dabb47 #!/usr/bin/ ...
- mybatis学习笔记四
记录下动态sql的常用标签: 1.where 一般用作数据操作添加的条件 例子: <select id="selectByRoleId" resultMap="re ...
- Cesium 生成terrain地形数据----CTB方式及步骤
背景:项目前端使用Cesium,地形服务一直使用外网的,常常因为翻墙访问的问题,导致地形数据取不到,进而导致地球不能加载,故决定搭建自己的地形服务,彻底解决这个问题.博文包含以下几个过程: 下载原始地 ...
- redis数据库写入数据时提示redis.exceptions.ResponseError错误
今天运行Django项目在redis数据库写入数据时提示如下错误: ERROR log 228 Internal Server Error: /image_code/cf9ccd75-d274-45c ...
- PictureService
package me.zhengjie.tools.service; import me.zhengjie.tools.domain.Picture; import org.springframewo ...
- CSS样式表---------第三章:样式属性
三.样式属性 1.背景与前景 background-color:#90; ------------背景色,样式表优先级高. background-image:url(路径)-------------- ...
- 关于dubbo接口性能测试
最初的压测这个dubbo接口有三种思路: .第一种就是基于业务,比如注册业务,注册成功后,会发送短信消息到用户手机,通过业务调用消息服务,最容易实现,但是业务瓶颈最大导致测试结果不准 .第二种是通 ...
- Oracle中的 timestamp 和 timestamp with time zone, timestamp with local time zone
SQL> select dbtimezone, sessiontimezone from dual; DBTIME ------ SESSIONTIMEZONE ---------------- ...
- Ubuntu 12.04 搭建TFTP服务器
吐槽先:在Ubuntu上搭建TFTP服务器,网上搜到一堆资料,可惜基本都是部分能用,至于哪些部分能用还要自己摸索着试出来,郁闷之情仅次于找不到任何资料…… ---------------------- ...
- Tomcat远程调试模式及利用Eclipse远程链接调试
1.启动tomcat到调试模式 进入到tomcat的bin目录下,执行命令./catalina.sh jpda run 启动日记会提示打开调试端口默认为8000 2.调试Eclipse远程连接tomc ...