当前位置: 首页 > 知识库问答 >
问题:

Spring Boot执行器显示微服务的状态下降

申自明
2023-03-14
{
  "status": "DOWN",
  "components": {
    "binders": {
      "status": "UP",
      "components": {
        "rabbit": {
          "status": "UP",
          "details": {
            "version": "3.7.8"
          }
        }
      }
    },
    "coreServices": {
      "status": "DOWN",
      "details": {
        "movie": {
          "status": "DOWN",
          "details": {
            "error": "io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: movie/172.21.0.8:80"
          }
        },
        "reviews": {
          "status": "DOWN",
          "details": {
            "error": "io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: review/172.21.0.9:80"
          }
        },
        "recommendations": {
          "status": "DOWN",
          "details": {
            "error": "io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: recommendation/172.21.0.6:80"
          }
        }
      }
    },
    "discoveryComposite": {
      "description": "Discovery Client not initialized",
      "status": "UNKNOWN",
      "components": {
        "discoveryClient": {
          "description": "Discovery Client not initialized",
          "status": "UNKNOWN"
        }
      }
    },
    "diskSpace": {
      "status": "UP",
      "details": {
        "total": 84014424064,
        "free": 28400906240,
        "threshold": 10485760
      }
    },
    "ping": {
      "status": "UP"
    },
    "rabbit": {
      "status": "UP",
      "details": {
        "version": "3.7.8"
      }
    },
    "reactiveDiscoveryClients": {
      "description": "Discovery Client not initialized",
      "status": "UNKNOWN",
      "components": {
        "Simple Reactive Discovery Client": {
          "description": "Discovery Client not initialized",
          "status": "UNKNOWN"
        }
      }
    }
  }
}
(base) mat@mat-Vostro-5471:~/Projects/movie-rest-services$ docker ps
CONTAINER ID        IMAGE                                 COMMAND                  CREATED             STATUS                    PORTS                                                                                        NAMES
376da889ce8c        movie-rest-services_review            "java -jar /app.jar"     23 minutes ago      Up 23 minutes             8080/tcp                                                                                     movie-rest-services_review_1
f4fe8c2668f2        movie-rest-services_movie             "java -jar /app.jar"     23 minutes ago      Up 23 minutes             8080/tcp                                                                                     movie-rest-services_movie_1
b2fa74bdb3ea        movie-rest-services_movie-composite   "java -jar /app.jar"     23 minutes ago      Up 23 minutes             0.0.0.0:8080->8080/tcp                                                                       movie-rest-services_movie-composite_1
d45062ca4e0c        movie-rest-services_recommendation    "java -jar /app.jar"     23 minutes ago      Up 23 minutes             8080/tcp                                                                                     movie-rest-services_recommendation_1
a16db364e277        movie-rest-services_eureka            "java -jar /app.jar"     23 minutes ago      Up 23 minutes             0.0.0.0:8761->8761/tcp                                                                       movie-rest-services_eureka_1
fd6b45ade9c3        rabbitmq:3.7.8-management             "docker-entrypoint.s…"   23 minutes ago      Up 23 minutes (healthy)   4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp   movie-rest-services_rabbitmq_1
68c9e3e92256        mongo:3.6.9                           "docker-entrypoint.s…"   23 minutes ago      Up 23 minutes (healthy)   0.0.0.0:27017->27017/tcp                                                                     movie-rest-services_mongodb_1
2ad058b543d8        mysql:5.7                             "docker-entrypoint.s…"   23 minutes ago      Up 23 minutes (healthy)   0.0.0.0:3306->3306/tcp, 33060/tcp                                                            movie-rest-services_mysql_1
spring.application.name: movie

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
    initialInstanceInfoReplicationIntervalSeconds: 5
    registryFetchIntervalSeconds: 5
  instance:
    leaseRenewalIntervalInSeconds: 5
    leaseExpirationDurationInSeconds: 5
server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
  # from: https://github.com/spring-cloud-samples/eureka/blob/master/src/main/resources/application.yml
  server:
    waitTimeInMsWhenSyncEmpty: 0
    response-cache-update-interval-ms: 5000

management.endpoints.web.exposure.include: "*"
private Mono<Health> getHealth(String url) {
    url += "/actuator/health";
    log.info("Will call the Health API on URL: {}", url);
    return getWebClient().get().uri(url).retrieve().bodyToMono(String.class)
            .map(s -> new Health.Builder().up().build())
            .onErrorResume(ex -> Mono.just(new Health.Builder().down(ex).build()))
            .log();
}

它将提供以下产出:

movie-composite_1  | 2020-02-11 18:03:07.251  INFO 1 --- [or-http-epoll-6] c.g.m.c.m.s.MovieCompositeIntegration    : Will call the Health API on URL: http://movie/actuator/health
movie-composite_1  | 2020-02-11 18:03:07.253  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.4             : onSubscribe(FluxOnErrorResume.ResumeSubscriber)
movie-composite_1  | 2020-02-11 18:03:07.253  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.4             : request(unbounded)
movie-composite_1  | 2020-02-11 18:03:07.256  INFO 1 --- [or-http-epoll-6] c.g.m.c.m.s.MovieCompositeIntegration    : Will call the Health API on URL: http://recommendation/actuator/health
movie-composite_1  | 2020-02-11 18:03:07.257  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.5             : onSubscribe(FluxOnErrorResume.ResumeSubscriber)
movie-composite_1  | 2020-02-11 18:03:07.257  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.5             : request(unbounded)
movie-composite_1  | 2020-02-11 18:03:07.260  INFO 1 --- [or-http-epoll-6] c.g.m.c.m.s.MovieCompositeIntegration    : Will call the Health API on URL: http://review/actuator/health
movie-composite_1  | 2020-02-11 18:03:07.261  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.6             : onSubscribe(FluxOnErrorResume.ResumeSubscriber)
movie-composite_1  | 2020-02-11 18:03:07.261  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.6             : request(unbounded)
movie-composite_1  | 2020-02-11 18:03:07.265  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.4             : onNext(DOWN {error=io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: movie/172.21.0.8:80})
movie-composite_1  | 2020-02-11 18:03:07.266  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.4             : onComplete()
movie-composite_1  | 2020-02-11 18:03:07.266  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.5             : onNext(DOWN {error=io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: recommendation/172.21.0.6:80})
movie-composite_1  | 2020-02-11 18:03:07.266  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.5             : onComplete()
movie-composite_1  | 2020-02-11 18:03:07.267  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.6             : onNext(DOWN {error=io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: review/172.21.0.9:80})
movie-composite_1  | 2020-02-11 18:03:07.273  INFO 1 --- [or-http-epoll-6] reactor.Mono.OnErrorResume.6             : onComplete()

你能给我一点提示吗?所有的测试都是通过的,mvn清洁安装也是成功的。

共有1个答案

岳京
2023-03-14

查看Docker PS结果时,Movie服务似乎正在侦听8080端口。

在这种情况下,您需要通过http://movie:8080/acturet/health访问该服务。其他服务也一样!

说明:

    null
 类似资料:
  • 我用SpringBoot创建了一个简单的演示应用程序,其中包括执行器。带有@Scheduled注释的任务显示在执行器中,但以编程方式启动的任务不会显示。有没有办法让他们也出现? 我已经注释了@Enable调度。 我的组件如下所示: 执行器的结果仅显示带注释的任务:

  • 我使用spring boot admin来监视微服务。 我已经在我的应用程序中使用了Spring Cloud Discovery,并在Spring Boot Admin Server中添加了一个DiscoveryClient: Spring Boot管理属性: 如何配置Spring Boot管理来监视https网关应用程序?

  • 我有一个前台服务,按下按钮后会显示一个窗口。有没有办法隐藏(或过度隐藏)服务窗口显示屏上的系统状态栏?有我可以用的旗子吗?我试着到处找,但运气不好。

  • 我有一个数据库结果,每一个调用创建500条记录500条,然后下一个500条,然后下一个 我需要运行一个记录每个不同线程执行特定任务的程序 我举的例子如下 ExecutorService executor=Executors.newFixedThreadPool(10); 我的问题是,在完成当前executer服务之前,it需要获得接下来的500个用户并尝试开始处理,我需要停止该操作,直到处理了前5

  • 按钮样式XML: 按下的按钮样式XML: 按钮样式选择器XML: AlertDialog自定义XML: 为什么当我按下LinearLayout时,选择器不能正常工作?它不是将“可提取”更改为“按下”状态。

  • 我正试图把普罗米修斯加入我的Spring靴项目。我正在使用Spring Boot执行器来公开度量endpoint。我按照教程做了所有的事情,但我总是得到一个404错误。我还尝试了中给出的每一个解决方案: context.xml(外部属性):