首页 > 编程语言 > 详细

SpringCloud——hystrix熔断器

时间:2020-01-08 22:32:27      阅读:88      评论:0      收藏:0      [点我收藏+]

Hystrix能做什么?

服务熔断、服务降级、服务限流、接近实时的监控...

参考:https://github.com/Netflix/Hystrix/wiki/How-To-Use

一旦调用服务方法失败并抛出了错误信息后,会自动调用 @HystrixCommand 标注好的 fallbackMethod 调用类中的指定方法。

dashboard监控窗口:

7色,1圈,1线

配置

被监控端需要引入以下依赖

<!-- actuator监控信息完善 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!--  hystrix -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>

加以下注解:
@SpringBootApplication
@EnableDiscoveryClient //服务发现
@EnableCircuitBreaker

监控端需要引入以下依赖

<!-- hystrix和 hystrix-dashboard相关-->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>

加以下注解:
@SpringBootApplication
@EnableHystrixDashboard

SpringCloud——hystrix熔断器

原文:https://www.cnblogs.com/tangjian07/p/12167025.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!