Ribbon

spring.io 官网的简介:

Ribbon is a client side load balancer which gives you a lot of control over the behaviour of HTTP and TCP clients.

自己的翻译:

Ribbon是一个用来负载均衡的客户端,对于http和tcp客户端行为,Ribbon能给与你很多的控制方式。

在给Ribbon设置熔断器Hystrix的时候发现熔断器不起作用。

代码如下:

例子参考来源: http://blog.csdn.net/forezp/article/details/69934399

 package com.example.demo;

 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.client.loadbalancer.LoadBalanced;
 import org.springframework.cloud.netflix.hystrix.EnableHystrix;
 import org.springframework.context.annotation.Bean;
 import org.springframework.web.client.RestTemplate;
 /**
  * 在工程的启动类中,通过 @EnableDiscoveryClient 向服务中心注册;
  * 并且向程序的ioc注入一个bean: restTemplate;
  * 并通过 @LoadBalanced 注解表明这个 restRemplate 开启负载均衡的功能。
  *
  *
  * 熔断器的使用
  * 在程序的启动类RibbonClientApplication 加 @EnableHystrix 注解开启Hystrix  不起作用
  *
  *
  */
 @SpringBootApplication
 @EnableDiscoveryClient  //.....
 //@EnableHystrix //......//注解不起作用
 @EnableCircuitBreaker //注解起作用,查看官方文档可知
 public class RibbonClientApplication {

     public static void main(String[] args) {
         SpringApplication.run(RibbonClientApplication.class, args);
     }

     @LoadBalanced //......
     @Bean
     public RestTemplate restTemplate() {
         return new RestTemplate();
     }
 }

spring cloud ----> RibbonClient设置的熔断器Hystrix不起作用的更多相关文章

  1. spring cloud学习笔记四 熔断器Hystrix

    我们知道分布式服务有这样一个特点,每一个微服务都有自己的业务,并且很多时候一个微服务的业务要依赖于其他微服务,如果这些相互关联的微服务中其中某个微服务请求失败时,就会导致其他调用它的微服务也会请求失败 ...

  2. spring cloud深入学习(五)-----熔断器Hystrix

    雪崩效应 在微服务架构中通常会有多个服务层调用,基础服务的故障可能会导致级联故障,进而造成整个系统不可用的情况,这种现象被称为服务雪崩效应.服务雪崩效应是一种因“服务提供者”的不可用导致“服务消费者” ...

  3. Spring Cloud(六):Hystrix 监控数据聚合 Turbine【Finchley 版】

    Spring Cloud(六):Hystrix 监控数据聚合 Turbine[Finchley 版]  发表于 2018-04-17 |  更新于 2018-05-07 |  上一篇我们介绍了使用 H ...

  4. Spring Cloud(五):Hystrix 监控面板【Finchley 版】

    Spring Cloud(五):Hystrix 监控面板[Finchley 版]  发表于 2018-04-16 |  更新于 2018-05-10 |  在上一篇 Hystrix 的介绍中,我们提到 ...

  5. 玩转Spring Cloud之熔断降级(Hystrix)与监控

    本文内容导航目录: 前言:解释熔断降级一.搭建服务消费者项目,并集成 Hystrix环境 1.1.在POM XML中添加Hystrix依赖(spring-cloud-starter-netflix-h ...

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

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

  7. 【Spring Cloud学习之六】断路器-Hystrix

    环境 eclipse 4.7 jdk 1.8 Spring Boot 1.5.2 Spring Cloud 1.2 一.服务雪崩1.什么是服务雪崩分布式系统中经常会出现某个基础服务不可用造成整个系统不 ...

  8. Spring Cloud (9) 服务容错保护-Hystrix断路器

    断路器 断路器本身是一种开关装置,用于在电路上保护线路过载,当线路中又电路发生短路时,断路器能够及时的切断故障电路,放置发生过载.发热.甚至起火等严重后果. 在分布式架构中,断路器模式的作用也是类似, ...

  9. Spring Cloud(4):断路器(Hystrix)

    Hystrix介绍 相对于单一系统,分布式系统更容易遇到故障,所以我们一般通过构建冗余,使用集群和负载均衡来保证系统的弹性和高可用.当然,这种方式只解决了一部分问题,当服务崩溃时,我们很容易检测到,因 ...

随机推荐

  1. GDPR

    http://column.caijing.com.cn/20180523/4457753.shtml

  2. centOS6.8开放防火墙端口

    1.找到防火墙配置文件,/etc/sysconfig/iptables.如果是新装的linux系统,防火墙默认是被禁掉的,没有配置任何防火墙策略,所以不存在iptables.需要在控制台使用iptab ...

  3. topcoder srm 530 div1

    problem1 link 对于每个还未切掉的‘X’用cutter作用一次.从左上角到右下角,依次判断即可. problem2 link 首先,如果一个顶点不能从0到达或者不能到达节点$n-1$,那么 ...

  4. android 系统 不深度休眠【转】

    本文转载自:https://blog.csdn.net/fmc088/article/details/80401405 1.分析解析 android系统有earlysuspend和suspend两种休 ...

  5. C语言goto语句的使用

    不使用goto语句: 使用goto语句: 使用goto语句时需要注意以下原则:1) 不要过份地使用.比如图2中的60行就没有采用goto语句跳到程序的最后面,之所以这里不使用goto是为了阅读方便.因 ...

  6. tp框架中的一些疑点知识-1

    tp默认的编码是utf-8 Runtime中的Cache和Logs都是分模块的,因为在应用app下可以有多个模块,但是 公共模块和Runtime模块只有一个, 所以, Runtime要包含各个模块的内 ...

  7. linux网络流量实时监控工具之nload

    Install nload on a CentOS/RHEL/Red Hat/Fedora Linux First, turn on EPEL repo on a CentOS or RHEL bas ...

  8. c# 之 Microsoft.Practices.EnterpriseLibrary连接Oracle

    首先下载Microsoft Enterprise Library 5.0:http://www.microsoft.com/en-us/download/details.aspx?id=15104,这 ...

  9. 【C#】取整函数Math.Round、Math.Ceiling和Math.Floor区别

    Math.Round 原则: 四舍六入五取偶. 也就是说 0.1-0.4为0 0.5为0 0.6-0.9为1 1.5为2 Math.Ceiling 原则: 有小数就加1 0.1 = 1 Math.Fl ...

  10. sublime text 中文显示异常

    本文链接:sublime text 中文显示异常 http://www.cnblogs.com/daysme/p/7549857.html 前言 sublime text 3143 用了一年时候,最近 ...