服务启动成功但Spring Admin和Actuator状态处于Down的排查

1.确认项目的pom依赖存在以下两项:

<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-client</artifactId>
    <version>2.0.5</version>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

2.application.yml文件里相关配置添加以下项目,注意对齐:

management:
  server:
    # 监控管理端口
    port: 你的端口
  endpoints:
    web:
      exposure:
        # 需要开放的 Actuator 监控端点,默认开放所有
        include: '*'
    health:
      sensitive: false
  endpoint:
    health:
      # 重要,排查问题必备,如果没有下面这项,访问/actuator/health时只会告诉你服务状态为down
      show-details: ALWAYS

3.重启服务,访问 服务ip:服务端口/actuator/health,查看返回信息中所有信息的status是否均为up

  例:

{"status":"UP","details":{"diskSpace":{"status":"UP","details":{"total":510745636864,"free":140418973696,"threshold":10485760}},"refreshScope":{"status":"UP"},"discoveryComposite":{"status":"UP","details":{"discoveryClient":{"status":"UP","details":{"services":["hzero-admin","hzero-config","hzero-todo-service"]}},"eureka":{"description":"Eureka discovery client has not yet successfully connected to a Eureka server","status":"UP","details":{"applications":{"HZERO-ADMIN":1,"HZERO-CONFIG":1,"HZERO-TODO-SERVICE":1}}}}},"hystrix":{"status":"UP"}}}

上图所示,当所有status均为up,服务状态为up。若某一项为down则服务状态为down。

现在把配置文件中的redis密码修改成错误的密码再重新启动,如下:

{"status":"DOWN","details":{"diskSpace":{"status":"UP","details":{"total":510745636864,"free":140385398784,"threshold":10485760}},"refreshScope":{"status":"UP"},"discoveryComposite":{"status":"UP","details":{"discoveryClient":{"status":"UP","details":{"services":["hzero-admin","hzero-config"]}},"eureka":{"description":"Eureka discovery client has not yet successfully connected to a Eureka server","status":"UP","details":{"applications":{"HZERO-ADMIN":1,"HZERO-CONFIG":1}}}}},"hystrix":{"status":"UP"},"redis":{"status":"DOWN","details":{"error":"org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: NOAUTH Authentication required."}}}}

如上所示,访问/actuator/health后发现服务状态为down,并且只有redis的status变为down,原因为没有在配置文件中配置正确的认证信息,根据错误详情修改配置文件后服务又成功恢复。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值