hystrix实战总结;

HystrixCircuitBreaker 有三种状态 :

断路器默认是20个请求失败才打开短路器,可以进行配置:

 

CLOSED :关闭

OPEN :打开

HALF_OPEN :半开

hystrix实战总结;_第1张图片hystrix实战总结;_第2张图片

 

 

1、接口正确,接口报超时;

https://www.cnblogs.com/EasonJim/p/7722372.html

hystrix实战总结;_第3张图片

2、springboot2.0后使用hystrix的监控必须得加:因为默认不是hystrix.stream

@Bean
    public ServletRegistrationBean getServlet() {
        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
        registrationBean.setLoadOnStartup(1);
        registrationBean.addUrlMappings("/hystrix.stream");
        registrationBean.setName("HystrixMetricsStreamServlet");
        return registrationBean;
    }

  加上后监控器才可以访问

hystrix实战总结;_第4张图片3、hystrix的的fallback触发机制详细介绍,这个博文非常好!!!!!!!

fallback触发;

https://blog.csdn.net/tongtong_use/article/details/78611225 

https://blog.csdn.net/jack281706/article/details/73743024(也很详细)

 

转载于:https://www.cnblogs.com/fengli9998/p/9257181.html

你可能感兴趣的:(hystrix实战总结;)