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监控的更多相关文章

  1. springcloud 入门 11 (Hystrix Dashboard)

    hystrix: 断路器我在前面已经介绍,不了解的可以参考 :springcloud 入门 6 (断路器hystrix)  关于搭建,测试我都在这里面进行说明了,这章介绍的是  Hystrix Das ...

  2. Spring Cloud(六):Hystrix 监控数据聚合 Turbine【Finchley 版】

    Spring Cloud(六):Hystrix 监控数据聚合 Turbine[Finchley 版]  发表于 2018-04-17 |  更新于 2018-05-07 |  上一篇我们介绍了使用 H ...

  3. springcloud(八) Hystrix监控

    一.Feign项目Hystrix自带的监控 在feign项目pom.xml 添加: <!-- 1,使用 Hystrix的模块 hystrix-metrics-event-stream,就可将这些 ...

  4. Spring Cloud 入门 之 Hystrix 篇(四)

    原文地址:Spring Cloud 入门 之 Hystrix 篇(四) 博客地址:http://www.extlight.com 一.前言 在微服务应用中,服务存在一定的依赖关系,如果某个目标服务调用 ...

  5. SpringCloud(2)---SpringCloud入门篇

    SpringCloud理解篇 一.微服务概述 1.什么是微服务 目前的微服务并没有一个统一的标准,一般是以业务来划分将传统的一站式应用,拆分成一个个的服务,彻底去耦合,一个微服务就是单功能业务,只做一 ...

  6. SpringCloud入门(一)

    一.微服务概述 1.什么是微服务 目前的微服务并没有一个统一的标准,一般是以业务来划分将传统的一站式应用,拆分成一个个的服务,彻底去耦合,一个微服务就是单功能业务,只做一件事. 与微服务相对的叫巨石 ...

  7. Spring Cloud(五):Hystrix 监控面板【Finchley 版】

    Spring Cloud(五):Hystrix 监控面板[Finchley 版]  发表于 2018-04-16 |  更新于 2018-05-10 |  在上一篇 Hystrix 的介绍中,我们提到 ...

  8. SpringCloud入门概述

    SpringCloud入门概述 Spring的三大模块:SpringBoot(构建),Spring Cloud(协调),Spring Cloud Data Flow(连接)注意:Spring Boot ...

  9. SpringCloud学习之Hystrix

    一.为什么要有断路器 在分布式系统当中,服务之间调用关系会随着业务的发展而变的复杂,一个服务可能依赖多个服务,服务之间层层依赖也是家常便饭的事情,如果一个服务的瘫痪很有可能导致整个系统的崩溃.比如说, ...

随机推荐

  1. Django中间件-跨站请求伪造-django请求生命周期-Auth模块-seettings实现可插拔配置(设计思想)

    Django中间件 一.什么是中间件 django中间件就是类似于django的保安;请求来的时候需要先经过中间件,才能到达django后端(url,views,models,templates), ...

  2. 892B. Wrath#愤怒的连环杀人事件(cin/cout的加速)

    题目出处:http://codeforces.com/problemset/problem/892/B 题目大意:一队人同时举刀捅死前面一些人后还活着几个 #include<iostream&g ...

  3. python学习笔记(25)-继承

    #继承 class RobotOne: #第一代机器人 def __init__(self,year,name): self.year=year self.name=name def walking_ ...

  4. 21)PHP,杨辉三角

    代码展示: $n=; ;$i<=$n;$i++){ ;$k<=$i;$k++){ ||$k==$i){ $arr[$i][$k]=; }else{ ){ $arr[$i][$k] = $a ...

  5. xml字符串转json字符串

    XML字符串转JSON字符串网上的方法很多,这里主要推荐两种: 1.使用org.json包 jar地址:http://mvnrepository.com/artifact/org.json/json ...

  6. PostgreSQL 安装之 CentOS 7 x64 RPM 安装

    PostgresQL 安装环境 一.CentOS 7 安装 1. 环境说明 CentOS7 PosgreSQL 11.2 2. 在线安装 到目前为止(2019-08-10),CentOS7 默认携带了 ...

  7. UFT场景恢复

    场景恢复: 在脚本运行中可能会出现一些非预期事件.错误.程序崩溃等情况,阻止脚本继续执行下去,在此情况下脚本可能暂停执行, 直到某些界面被操作之后才会继续执行下去,为了处理这一类事件因此存在场景恢复. ...

  8. Linux把内存挂载成硬盘提高读写速度

    tmpfs是一种虚拟内存文件系统正如这个定义它最大的特点就是它的存储空间在VM里面,这里提一下VM(virtual memory),VM是由linux内核里面的vm子系统管理,现在大多数操作系统都采用 ...

  9. Qt unsigned char *与QString之间的相互转换

    //unsiged char *转QString unsigned char  *str = "fdd" ; char *str1 = (char *)str; QString s ...

  10. python两个队列实现一个栈和两个栈实现一个队列

    1.两个栈实现一个队列 两个栈stack1和stack2, push的时候直接push进stack1,pop时需要判断stack1和stack2中的情况.如果stack2不为空的话,直接从stack2 ...