spring-boot-actuator的/health端点返回值是down问题

        不说废话,项目中使用spring boot 1.5.7 + spring cloud Dalston.SR3版本 搭建,在访问actuator中的health端点时,刚开始只返回{“status”:"down"},没有详细的信息,最后查阅资料:a链接 得知spring boot 2.0 以下需要在配置文件中新增如下内容:management.security.enabled=false, spring boot 2.0 以上请参考 a链接 ,需要在配置文件中新增: management.endpoint.health.show-details=always 。

        第二个问题是,项目中访问health,发现返回的status总为down,显示详细信息后发现如下:


         发现是consul的状态一致为down导致,但是consul服务上显示所有服务都是正常的,还是在stackOverFlow这个伟大的网站上找到了原因 传送门 ,原来我spring cloud 版本使用的是 Dalston.SR3版本,这个版本的 spring-cloud-starter-consul-discovery 版本为 1.2.1 RELEASE,然而consul升级到1.x以后会有bug,需要把spring-cloud-starter-consul-discovery升级到1.3以上,然后我换成 Edgware.SR3 版本,返回正常:



猜你喜欢

转载自blog.csdn.net/white_ice/article/details/80511588