Hystrix结合Turbine使用详述

简介: Hystrix结合Turbine使用详述

目录


1、简介


2、正文


2.1 快速搭建


2.2 服务启动


2.3 注意事项


1、简介

Hystrix Dashboard虽然好用,但是它有一个缺点:一个Hystrix Dashboard只能收集一个微服务的Hystrix流。也就是说对于每个微服务,我们都需要开启一个Hystrix Dashboard来监控其健康情况。可以看到如下Hystrix Dashboard只能输入一个actuator端点地址。image.png忍不了我们就可以使用Turbine;Netfilx的Turbine项目,提供了将多个微服务的Hystrix流数据聚合到一个流中,并且通过一个Hystrix Dashboard进行展示,这样就可以很nice的同时监控多个微服务的健康状况啦!


Turbine项目的大致架构图如下所示:


image.png没有Turbine之前,每个微服务都需要开启一个Hystrix Dashboard页面来监控当前微服务的健康情况,有了Turbine之后,多个微服务的信息先通过Turbine进行聚合,再统一在一个Hystrix Dashboard页面展示。


2、正文

2.1 快速搭建

服务列表:

我这里一共搭建了六个服务,其中eureka-server为注册中心,turbine-server为turbine服务,hystrix-dashboard-server为hystrix-dashboard服务(这些服务如果有需要你也可以在一个服务中启动),user-server、order-server、message-server三个服务是受hystrix保护的服务。image.png

<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>2.3.4.RELEASE</version>
</parent>
<properties>
  <spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
</properties>
<dependencies>
  <!--web-->
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
  </dependency>
  <!--actuator-->
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
  </dependency>
  <!--eureka server-->
  <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
  </dependency>
  <!--eureka client-->
  <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</artifactId>
  </dependency>
  <!--turbine-->
  <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-turbine</artifactId>
  </dependency>
  <!--hystrix-dashboard-->
  <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
  </dependency>
</dependencies>
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-dependencies</artifactId>
      <version>${spring-cloud.version}</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

image.pngimage.pngimage.pngimage.pngimage.png启动类,添加@EnableTurbine启动turbine

@SpringBootApplication// 开启turbine@EnableTurbinepublic class TurbineServerApp {    public static void main(String[] args) {        SpringApplication.run(TurbineServerApp.class, args);    }}

hystrix-dashboard-server服务搭建:

application.yml配置文件

server:  port: 55555eureka:  client:    service-url:      defaultZone: http://localhost:4010/eureka    ## 不注册      register-with-eureka: false

启动类,添加@EnableHystrixDashboard启动HystrixDashboard

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

2.2 服务启动

服务启动应先启动注册中心eureka-server再启动user-server、order-server、message-server服务,最后启动turbine-server和hystrix-dashboard-server。

启动完成之后,先查看eureka-server注册中心上服务是否注册正常


http://localhost:4010/image.pngimage.pngimage.pngimage.png


image.png

目录
相关文章
|
9月前
|
监控 Java 微服务
SpringCloud极简入门-服务监控-Hystrix Dashboard & Turbine
Hystrix是一种服务熔断机制,其熔断降级策略有效的防止了微服务的雪崩问题,Hystrix的出现提高了微服务的可用性和健壮性,而Hystrix Dashboard则是用来监控Hystrix的熔断器状况的重要组件(又叫仪表盘),它提供了数据监控,健康状态,熔断状态,并发数量等等信息,和友好的图形化展示界面,能让使用者很好的监控和分析熔断器的状态。
125 0
|
12月前
|
监控 Java 微服务
Hystrix数据进行聚合展示-Turbine(HTTP方式)
Hystrix数据进行聚合展示-Turbine(HTTP方式)
|
监控 数据可视化 Java
springcloud 入门(5) Hystrix Dashboard &Turbine
springcloud 入门(5) Hystrix Dashboard &Turbine
160 0
springcloud 入门(5) Hystrix Dashboard &Turbine
|
监控 负载均衡 网络协议
Spring Cloud(五)《Turbine 监控信息聚合展示 Hystrix》
Hystrix Dashboard 可以定时收集接口调用信息;时长、次数、性能、熔断等各项指标来进行监控展示,但是我们每次监控都需要输入一个Hystrix 的链接例如:http://localhost:9001/actuator/hystrix.stream,但是这样并不利于我们去做整体服务的监控,并且在实际使用的过程中如果是几十到几百个接口那么这样的监控几乎达不到监控效果,就累死在监控路上了。因此我们需要使用到 Turbine 来进行监控信息聚合,可以按业务组定义配置方便监控。
152 0
Spring Cloud(五)《Turbine 监控信息聚合展示 Hystrix》
|
监控 Java 微服务
Spring Cloud实战小贴士:turbine如何聚合设置了context-path的hystrix数据
Spring Cloud实战小贴士:turbine如何聚合设置了context-path的hystrix数据
185 0
|
监控
业余草 SpringCloud教程 | 第十二篇: 断路器聚合监控(Hystrix Turbine)(Finchley版本)
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xmt1139057136/article/details/81414045 上一篇文章讲述了如何利用Hystrix Dashboard去监控断路器的Hystrix command。
1409 0
|
监控 Java 开发工具
spring-cloud:熔断监控Hystrix Dashboard和Turbine的示例
1.运行环境 开发工具:intellij idea JDK版本:1.8 项目管理工具:Maven 4.0.0 2.GITHUB地址 https://github.com/nbfujx/springCloud-learn-demo/tree/master/spring-cloud-hystrix-dashboard-turbine .
1037 0
|
监控 Java Spring
springcloud(五):熔断监控Hystrix Dashboard和Turbine
Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数据。
1423 0
|
监控 Java Spring
springcloud(五):熔断监控Hystrix Dashboard和Turbine
Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数据。但是只使用Hystrix Dashboard的话, 你只能看到单个应用内的服务信息, 这明显不够. 我们需要一个工具能让我们汇总系统内多个服务的数据并显示到Hystrix D
2241 0
|
5月前
|
缓存 运维 监控
微服务技术系列教程(22) - SpringCloud- 服务保护机制Hystrix
微服务技术系列教程(22) - SpringCloud- 服务保护机制Hystrix
60 0