5.3. Hystrix的健康监测
1、添加依赖
<!--添加认证监控-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
2、浏览器访问 http://192.168.215.2:8908/actuator/health
就能显示Hystrix开启状态信息。
有人说,Spring boot 2.x 使用了endpoint,导致/actuator/health,/actuator/hystrix.stream都无法访问,报404错误。
我用的Spring Cloud 版本是Finchley.RELEASE,但是我没遇上,如果有人遇上,可以试试以下三种方法。而我将以下三种方法注释掉,一样能显示Hystrix的/actuator/health,/actuator/hystrix.stream信息
设置让endpoint允许显示/actuator/health,/actuator/hystrix.stream信息的方法如下:
方式一:在application.yml中添加如下配置:
management:
endpoint:
health:
show-details: always #允许显示/ac