zoukankan      html  css  js  c++  java
  • SpringCloud——hystrix熔断器

    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

  • 相关阅读:
    hihoCoder#1142(三分求极值)
    hihoCoder#1095(二分搜索)
    hihoCoder#1139(二分+bfs)
    java亦或(^)
    JAVA线程
    java中io流浅析
    java循环
    java集合练习
    JAVA集合
    java面向对象(串)
  • 原文地址:https://www.cnblogs.com/tangjian07/p/12167025.html
Copyright © 2011-2022 走看看