微服务springcloud—Hystrix断路器的状态监控和深入理解

Hystrix断路器的状态监控和深入理解

还记得之前为项目引入Spring Boot Actuator吗?

	<dependency>
		<groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

断路器的状态也会暴露在Actuator提供的/health端点中,这样就可以直观地了解断路器的状态。下面我们做一点实验,深入理解断路器的状态转换。

测试

1.启动项目microservice-discovery-eureka。
2.启动项目microservice-provider-user。
3.启动项目microservice-consumer-movie-ribbon-hystrix。
4.访问http://localhost:8010/user/1,可获得正常结果。
5.访问http://localhost:8010/actuator/health
在这里插入图片描述
6.停止microservice-provider-user,访问http://localhost:8010/user/1,可获得如下结果。
在这里插入图片描述
7.访问http://localhost:8010/actuator/health
在这里插入图片描述
在这里插入图片描述

本文大部分内容转载自周立的《Spring Cloud与Docker微服务架构实战》

猜你喜欢

转载自blog.csdn.net/weixin_43439494/article/details/83656615