spring cloud 2.0 入门系列一 (6)断路器聚合监控-Hystrix Turbine

Hystrix Dashboard集成Turbine

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

服务说明

上一篇讲了Hystrix Dashboard,实现了断路器的监控,但在微服务架构下,每个服务必然会有多个实例,一个一个实例监控会非常麻烦,这里我们介绍Turbine来实现服务断路器集群监控。

应用说明

使用框架

  • SpringBoot 2.0.3
  • SpringCloud Finchley.RELEASE

环境搭建

pom依赖
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- 系统注册与监测服务 -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

<!-- hystrix仪表盘 -->
<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>
启动类修改

在Spring启动类上添加注释**@EnableTurbine**

配置文件
server:
  port: 8763

eureka:
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

spring:
  application:
    name: cloud-hystrix-dashboard

turbine:
  aggregator:
    cluster-config: default
  app-config: app-console-web
  instanceUrlSuffix: /hystrix.stream
  cluster-name-expression: new String("default")

访问

  • 启动应用,输入地址:http://localhost:8763/hystrix
  • 在页面中输入地址:http://localhost:8763/turbine.stream
  • 点击monitor stream
  • 调用一次Hystrix接口就可以在页面看到效果了

示例代码

https://gitee.com/xiaoxming/cloud_project/tree/master/cloud-hystrix-dashboard

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值