改造feign 项目

1 启动类添加注解  @EnableHystrix

2 添加如下配置文件

  

#ji
eureka.instance.metadata-map.cluster=MAIN
#actuator
management.server.port=9003
management.endpoints.web.exposure.include="*"
management.endpoints.web.cors.allowed-origins="*"
management.endpoints.web.cors.allowed-methods="*"

feign.hystrix.enabled=true

3 添加如下 pom依赖

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>

<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>

创建一个springboot项目  spring-cloud-turbine

1 pom.xml

<?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.</modelVersion> <groupId>com.example</groupId>
<artifactId>Spring-Cloud-Turbine</artifactId>
<version>0.0.-SNAPSHOT</version>
<packaging>jar</packaging> <name>Spring-Cloud-Turbine</name>
<description>Demo project for Spring Boot</description> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0..RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent> <properties>
<project.build.sourceEncoding>UTF-</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-turbine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<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-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> </project>

2 配置文件

server.port=
spring.application.name=turbine eureka.client.service-url.defaultZone=http://127.0.0.1:8080/eureka/ turbine.app-config=feign-consumer
# dan ge setting
#turbine.cluster-name-expression=new String("default")
#turbine.combine-host-port=true #ji qun setting
turbine.aggregator.clusterConfig=MAIN
turbine.cluster-name-expression=metadata['cluster']

3 启动类

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

依次启动 eureka ,feign,turbine 三个项目

访问  http://127.0.0.1:7032/hystrix ,出现如下网页

输入  http://127.0.0.1:7032/turbine.stream?cluster=MAIN

成功出现熔断面板

  

spring cloud (五) 熔断面板 聚合熔断 turbine的更多相关文章

  1. spring cloud 2.x版本 Gateway熔断、限流教程

    前言 本文采用Spring cloud本文为2.1.8RELEASE,version=Greenwich.SR3 本文基于前两篇文章eureka-server.eureka-client.eureka ...

  2. Spring Cloud微服务如何实现熔断降级?

    熔断限流概述 在基于Spring Cloud的微服务架构体系下,按照系统功能边界的不同划分,原先大而全的系统会被拆分为多个不同的微服务,而相应的微服务会提供一组功能关联的服务接口,并向系统中的其他微服 ...

  3. spring cloud(五)熔断监控Hystrix Dashboard和Turbine

    Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数 ...

  4. Spring Cloud(五):熔断监控Hystrix Dashboard和Turbine

    Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数 ...

  5. spring cloud 系列第5篇 —— hystrix+turbine 服务的熔断与监控 (F版本)

    源码Gitub地址:https://github.com/heibaiying/spring-samples-for-all 一.hystrix 简介 1.1 熔断器 在分布式系统中,由于服务之间相互 ...

  6. spring cloud Hystrix监控面板Hystrix Dashboard和Turbine

    我们提到断路器是根据一段时间窗内的请求情况来判断并操作断路器的打开和关闭状态的.而这些请求情况的指标信息都是HystrixCommand和HystrixObservableCommand实例在执行过程 ...

  7. spring cloud 学习(4) - hystrix 服务熔断处理

    hystrix 是一个专用于服务熔断处理的开源项目,当依赖的服务方出现故障不可用时,hystrix有一个所谓的断路器,一但打开,就会直接拦截掉对故障服务的调用,从而防止故障进一步扩大(类似中电路中的跳 ...

  8. Spring Cloud Alibaba:Sentinel实现熔断与限流

    一.什么是Sentinel Sentinel,中文翻译为哨兵,是为微服务提供流量控制.熔断降级的功能,它和Hystrix提供的功能一样,可以有效的解决微服务调用产生的“雪崩效应”,为微服务系统提供了稳 ...

  9. Spring Cloud Zuul网关 Filter、熔断、重试、高可用的使用方式。

    时间过的很快,写springcloud(十):服务网关zuul初级篇还在半年前,现在已经是2018年了,我们继续探讨Zuul更高级的使用方式. 上篇文章主要介绍了Zuul网关使用模式,以及自动转发机制 ...

随机推荐

  1. django orm 改动数据库中已存在的表(添加、删除、修改表字段)

    python3 manage.py makemigrations --empty api # 因为我的models.py文件并直接在项目根目录,而是根目录下的api目录中 python3 manage ...

  2. 百度AI身份证识别demo,使用js提交图片数据

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...

  3. SQL - 外链接和内连接

    外链接和内连接: leetcode 题目:编写一个 SQL 查询,满足条件:无论 person 是否有地址信息,都需要基于上述两表提供 person 的以下信息: 第一次的答案:(错误) select ...

  4. python入门之格式化输出

    目录 扩展: 保留几位小数 一.占位符格式化输出 1.1 %s 1.2 %d 二..format()方式 三.f-string 扩展: 保留几位小数 保留两位小数 a = 12345.2487 pri ...

  5. jQuery中$(this)与this的区别

    经常在写jQuery的时候分不清this 和 $(this),为了方便起见尽量不用this,只用$(this).但是今天在别人的代码的基础上改一些东西,又遇到了这个this,不得不把它弄明白. $(t ...

  6. WEUI Search Input回车键无法跳转解决

    现象:回车键依然当前页面, window.location.href 设置无法起作用 增加 window.event.returnValue = false; 解决问题

  7. UV数据与风速风向数据转换

    package com.qr.util; import java.text.DecimalFormat; /** * //TODO UV数据与风速风向数据转换 */ public class UVAn ...

  8. golang(一)

    开篇先来个Go语言的吉祥物-金花鼠Gordon. golang是谷歌2009年发布的开源编程语言,截止目前go的release版本已经到了1.10.go语言的开发人员都是计算机界大神一般的存在: Th ...

  9. PB 将菜单中的部分按钮设置为某些页面不可选中

    if tab_1.selectedtab = 9 or tab_1.selectedtab = 10 then uo_toolbarstrip.of_enable(uo_toolbarstrip.of ...

  10. Latex中如何设置字体颜色(三种方式)

    1.直接使用定义好的颜色 \usepackage{color} \textcolor{red/blue/green/black/white/cyan/magenta/yellow}{text} 其中t ...