单机模式

1.创建一个dashboard项目

2.引入依赖

<!--histrix依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<!--dashboard依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
<!--端点依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

3.在主类上打上注解@EnableHystrixDashboard开启dashboard

@SpringBootApplication
@EnableHystrixDashboard
public class SpringCloudDashboardApplication { public static void main(String[] args) {
SpringApplication.run(SpringCloudDashboardApplication.class, args);
} }

4.配置文件配置应用名字和端口

spring:
application:
name: hystrix-dashboard
server:
port: 2001

5.启动访问http://127.0.0.1:2001/hystrix

6.在consumer增加hystirx端点的Servlet

/**
* 用于开启histrix 端点 用于dashboard图形化
*/
@Configuration
public class HystrixStreamServletConfig {
@Bean
public ServletRegistrationBean getServlet() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/actuator/hystrix.stream"); registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; }
}

7.访问http://127.0.0.1:9001/actuator/hystrix.stream  出现以下内容表示成功 将连接粘贴到仪表盘 开启分析

8.将连接粘贴到仪表盘 开启监控和分析

9.访问一个hystrix请求将会出现监控页面

Turbine集群模式

1.创建一个Turbine项目

2.添加依赖

<!--&lt;!&ndash;实现hystrix集群监控依赖&ndash;&gt;-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-turbine</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>

3.开启turbine自动化配置和注册中心服务发现的功能 turbine里面依赖eurekaClient

SpringBootApplication
@EnableTurbine//启用turbine
@EnableDiscoveryClient //开启服务发现
public class SpringCloudTurbineApplication { public static void main(String[] args) {
SpringApplication.run(SpringCloudTurbineApplication.class, args);
} }

4.配置文件配置

spring:
application:
name: trubine #http://localhost:9090/turbine.stream
server:
port: 9090
eureka:
client:
serviceUrl:
defaultZone: http://peer1:1111/eureka,http://localhost:peer2/eureka
turbine:
app-config: consumer #监控的服务名 多个,号隔开
cluster-name-expression: new String('default') #指定集群的名称为default 当服务非常多turbine可以启动多个turbine构建集群 具体书194页
combine-host-port: true #可以通过主机名和端口名组合来进行区分

5.打包2个consumer并启动

6.在hystirx仪表盘配置监听trubine连接http://localhost:9090/turbine.stream

基于消息代理

整合MQ

测试失败

Spring Cloud-hystrix Dashboard(八)的更多相关文章

  1. Spring Cloud Hystrix Dashboard熔断器-Turbine集群监控(六)

    序言 上一篇说啦hystrix的使用方法与配置还有工作流程及为何存在,我去,上一篇这么屌,去看看吧,没这么屌的话,我贴的有官方文档,好好仔细看看 hystrix除啦基本的熔断器功能之外,还可以对接口的 ...

  2. Spring Cloud Hystrix Dashboard的使用 5.1.3

      Hystrix除了可以对不可用的服务进行断路隔离外,还能够对服务进行实时监控.Hystrix可以实时.累加地记录所有关于HystrixCommand的执行信息,包括每秒执行多少.请求成功多少.失败 ...

  3. spring cloud: Hystrix(八):turbine集群监控(dashboard)

    turbine是聚合服务器发送事件流数据的一个工具,hystrix的监控中,只能监控单个节点,实际生产中都为集群, 因此可以通过turbine来监控集群下hystrix的metrics情况,通过eur ...

  4. spring cloud hystrix dashboard 没有/actuator/hystrix.stream路径解决

    首先我用的是spring boot Greenwich.SR2 在测试hystrix-dashboard监控服务时,发现访问localhost:9001/actuator/hystrix.stream ...

  5. Spring Cloud 2-Hystrix DashBoard仪表盘(五)

    Spring Cloud  Hystrix DashBoard  1.监控系统配置 pom.xml application.yml Application.java 2.被监控服务配置 pom.xml ...

  6. 微服务架构之spring cloud hystrix&hystrix dashboard

    在前面介绍spring cloud feign中我们已经使用过hystrix,只是没有介绍,spring cloud hystrix在spring cloud中起到保护微服务的作用,不会让发生的异常无 ...

  7. Spring Cloud 微服务笔记(六)Spring Cloud Hystrix

    Spring Cloud Hystrix Hystrix是一个延迟和容错库,旨在隔离远程系统.服务和第三方库,阻止链接故障,在复杂的分布式系统中实现恢复能力. 一.快速入门 1)依赖: <dep ...

  8. 试水Spring Cloud Hystrix

    Spring Cloud Hystrix是一个容错库,它实现了断路器模式,使得当服务发生异常时,会自动切断连接,并将请求引导至预设的回调方法. 服务端 在Spring Tool Suite的文件菜单中 ...

  9. Spring Cloud Hystrix理解与实践(一):搭建简单监控集群

    前言 在分布式架构中,所谓的断路器模式是指当某个服务发生故障之后,通过断路器的故障监控,向调用方返回一个错误响应,这样就不会使得线程因调用故障服务被长时间占用不释放,避免故障的继续蔓延.Spring ...

  10. 分布式系统的延时和故障容错之Spring Cloud Hystrix

    本示例主要介绍 Spring Cloud 系列中的 Eureka,如何使用Hystrix熔断器容错保护我们的应用程序. 在微服务架构中,系统被拆分成很多个服务单元,各个服务单元的应用通过 HTTP 相 ...

随机推荐

  1. 一句话实现Mysql查询结果带行号

    SELECT @rowno:=@rowno + 1 AS rowno,a.* FROM tableName a,(SELECT @rowno:=0) b

  2. C++源码实现:21种常用设计模式

    C++源码实现:21种常用设计模式一直以来在设计模式的学习中,都是出现java的源码,这对学习C++的极度不友好.本工程是基于C++实现21种常用的设计模式,里面包含了实例代码和示例.编写的时候在学习 ...

  3. B1001 狼抓兔子 最小割

    题目描述 现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的, 而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一个网格的地形: ...

  4. Asteroids(匈牙利算法)

    求最小点覆盖数,即最大匹配数,匈牙利算法. #include<stdio.h> #include<string.h> ][],vis[],linker[];//linker[] ...

  5. web动画小结

    前端写动画,无非两种方案,一种是通过css,另一种是js css的方案: 1.transform的单独使用 (IE9+) rotate(90deg) 2d旋转,也可以理解为沿着3D的Z轴旋转 rota ...

  6. C99新增内容之复合文字(compound literal)

    前言: 最近在复习C,发现了一些新东西,例如:变长数组,复合文字,指针的兼容性等.今天先简单谈一下复合文字. 正文: 假如需要向带有一个int参量的函数传递一个值,您可以传递一个int变量,也可以传递 ...

  7. 【SQL】ROWNUM和ROWID

    一.ROWNUM ROWNUM伪列是Oracle先查到结果集之后再加上去的一个伪列,这个伪列对符合条件的结果添加一个从1开始的序列号,并且序列号是从1开始增序排列的. SQL> select r ...

  8. 【oracle开发】wmsys.wm_concat介绍

    wmsys.wm_concat是一个聚合函数,其作用是将一列数据转换成一行,也就是我们常用的行专列,但是该函数是一个undocument函数,所以不推荐大家使用这个函数.因为在后续的版本中还提不提供这 ...

  9. Percona Xtrabackup导出/导入单表

    默认情况下,InnoDB表不能通过直接复制表文件的方式在mysql服务器之间进行移植,即便使用了innodb_file_per_table选项.而使用Xtrabackup工具可以实现此种功能,不过,此 ...

  10. CXF-JAX-WS开发(一)入门案例

    一.Web Service 1.定义 W3C定义,Web服务(Web service)应当是一个软件系统,用以支持网络间不同机器的互动操作. 2.作用 多系统间数据通信 二.CXF是什么? CXF是目 ...