前言:

必需学会SpringBoot基础知识

简介:

spring cloud 为开发人员提供了快速构建分布式系统的一些工具,包括配置管理、服务发现、断路器、路由、微代理、事件总线、全局锁、决策竞选、分布式会话等等。它运行环境简单,可以在开发人员的电脑上跑。

工具:

JDK8

apache-maven-3.5.2

IntelliJ IDEA 2017.3 x64

一、Hystrix Turbine简介

看单个的Hystrix Dashboard的数据并没有什么多大的价值,要想看这个系统的Hystrix Dashboard数据就需要用到Hystrix Turbine。Hystrix Turbine将每个服务Hystrix Dashboard数据进行了整合。Hystrix Turbine的使用非常简单,只需要引入相应的依赖和加上注解和配置就可以了。

二、准备工作

本文使用的工程为上一篇文章的工程,在此基础上进行改造。需要添加两个服务项目, 本章节共需要四个项目, 3 and 4 是追加的

  1. eureka-server-hystrix-dashboard
  2. eureka-client-hystrix-dashboard
  3. eureka-client-hystrix-dashboard2 (仿照 2 改造*yml,需要修改名称加载顺序)
  4. eureka-client-hystrix-turbine

三、创建 eureka-client-hystrix-turbine

引入相应的依赖:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.lwc</groupId>
<artifactId>eureka-client-hystrix-turbine</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>eureka-client-hystrix-turbine</name>
<description>Demo project for Spring Boot</description> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Edgware.SR2</spring-cloud.version>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-turbine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</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> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> <repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories> </project>

配置文件application.yml:

spring:
application.name: eureka-client-hystrix-turbine
server:
port: 8769
security.basic.enabled: false
turbine:
aggregator:
clusterConfig: default
appConfig: eureka-client-hystrix-dashboard,eureka-client-hystrix-dashboard2
clusterNameExpression: new String("default")
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka/

配置文件, 具体我也是看百度在修改. 其实也无什么, 看API也有!

四、Turbine演示

依次开启工程:

  1. eureka-server-hystrix-dashboard
  2. eureka-client-hystrix-dashboard
  3. eureka-client-hystrix-dashboard2
  4. eureka-client-hystrix-turbine

打开浏览器输入: http://localhost:8761/ 查看注册中心界面如下:

打开浏览器输入:http://localhost:8769/turbine.stream,界面如下:

请求 (如果不依次, 你可能会感觉出问题, 因为WEB无数据)

http://localhost:8762/eureka/client?name=eddie

http://localhost:8763/eureka/client?name=eddie

打开:http://localhost:8763/hystrix,输入监控流http://localhost:8769/turbine.stream

点击monitor stream 进入页面:

可以看到这个页面聚合了2个service的hystrix dashbord数据。

提醒: 如果WEB UI 没有数据, 建议你把全部服务重启在试试!

五、源码下载:

标签 12-1

https://github.com/eddie-code/SpringCloudDemo

【SpringCloud】第十二篇: 断路器监控(Hystrix Turbine)的更多相关文章

  1. 史上最简单的SpringCloud教程 | 第十二篇: 断路器监控(Hystrix Dashboard)(Finchley版本)

    转载请标明出处: 原文首发于:https://www.fangzhipeng.com/springcloud/2018/08/30/sc-f12-dash/ 本文出自方志朋的博客 在我的第四篇文章断路 ...

  2. 史上最简单的SpringCloud教程 | 第十二篇: 断路器监控(Hystrix Dashboard)

    转载请标明出处: 首发于:https://www.fangzhipeng.com/springcloud/2017/07/12/sc12-hystix-dashbd/ 本文出自方志朋的博客 最新Fin ...

  3. SpringCloud教程 | 第十二篇: 断路器监控(Hystrix Dashboard)

    版权声明:本文为博主原创文章,欢迎转载,转载请注明作者.原文超链接 ,博主地址:http://blog.csdn.net/forezp. http://blog.csdn.net/forezp/art ...

  4. 【SpringCloud】第十一篇: 断路器监控(Hystrix Dashboard)

    前言: 必需学会SpringBoot基础知识 简介: spring cloud 为开发人员提供了快速构建分布式系统的一些工具,包括配置管理.服务发现.断路器.路由.微代理.事件总线.全局锁.决策竞选. ...

  5. 跟我学SpringCloud | 第十二篇:Spring Cloud Gateway初探

    SpringCloud系列教程 | 第十二篇:Spring Cloud Gateway初探 Springboot: 2.1.6.RELEASE SpringCloud: Greenwich.SR1 如 ...

  6. SpringCloud教程 | 第四篇:断路器(Hystrix)

    在微服务架构中,根据业务来拆分成一个个的服务,服务与服务之间可以相互调用(RPC),在Spring Cloud可以用RestTemplate+Ribbon和Feign来调用.为了保证其高可用,单个服务 ...

  7. 史上最简单的SpringCloud教程 | 第四篇:断路器(Hystrix)

    在微服务架构中,根据业务来拆分成一个个的服务,服务与服务之间可以相互调用(RPC),在Spring Cloud可以用RestTemplate+Ribbon和Feign来调用.为了保证其高可用,单个服务 ...

  8. 【SpringCloud】第四篇:断路器(Hystrix)

    前言: 必需学会SpringBoot基础知识 简介: spring cloud 为开发人员提供了快速构建分布式系统的一些工具,包括配置管理.服务发现.断路器.路由.微代理.事件总线.全局锁.决策竞选. ...

  9. SpringCloud教程 | 第四篇:断路器(Hystrix)(Finchley版本)

    在微服务架构中,根据业务来拆分成一个个的服务,服务与服务之间可以相互调用(RPC),在Spring Cloud可以用RestTemplate+Ribbon和Feign来调用.为了保证其高可用,单个服务 ...

随机推荐

  1. sqoop2启动client异常

    java环境:  java version "10.0.1" ,启动sqoop-shell端或者是sqoop-client端异常,异常如下: [root@hadoop1 home] ...

  2. unittest 测试

    unittest 测试 单元测试是用来对一个模块.一个函数或者一个类来进行正确性检验的测试工作. 比如对函数abs(),我们可以编写出以下几个测试用例: 输入正数,比如1.1.2.0.99,期待返回值 ...

  3. MFC文档应用程序CToolBar:设置两个工具条并列停靠到同一条边上 转

    转自:http://blog.csdn.net/panshiqu/article/details/9369891# 将多个工具条同时并列停靠在某窗口的某一条边上.对于这种停靠方法,利用上述工具条控制函 ...

  4. Ubuntu 编译出现 ISO C++ 2011 不支持的解决办法

    问题 在编译时出现如下error: error:This file requires compiler and library support for the ISO C++ 2011 standar ...

  5. 关于换行这个动作,win 和 mac 的实现

    ‘\r'是回车,前者使光标到行首,(carriage return)'\n'是换行,后者使光标下移一格,(line feed) \r 是回车,return\n 是换行,newline 对于换行这个动作 ...

  6. ABP在领域事件中异步调用方法抛异常

    在领域事件中调用UserRegistrationManager.RegisterAsync抛异常 Call UserRegistrationManager.RegisterAsync() throw ...

  7. alter修改表

    alter修改表的基础语句,语法如下: ALTER TABLE table_name ADD column_name|MODIFY column_name| DROP COLUMN column_na ...

  8. Immutable.js 以及在 react+redux 项目中的实践

    来自一位美团大牛的分享,相信可以帮助到你. 原文链接:https://juejin.im/post/5948985ea0bb9f006bed7472?utm_source=tuicool&ut ...

  9. django 登录注册注销

    一.设计数据模型 1.数据库模型设计 作为一个用户登录和注册项目,需要保存的都是各种用户的相关信息.很显然,我们至少需要一张用户表User,在用户表里需要保存下面的信息: 用户名 密码 邮箱地址 性别 ...

  10. 旭日图(sunburst chart)绘制:R语言 & excel

    旭日图(sunburst chart)也叫太阳图,一种圆环镶接图,每一个圆环就代表了同一级别的比例数据,离原点越近的圆环级别越高,最内层的圆表示层次结构的顶级.除了圆环外,旭日图还有若干从原点放射出去 ...