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

AWS中Java Sping引导应用程序部署问题的服务器健康状态错误

印辉
2023-03-14

>

  • 我正在尝试在AWS弹性Bean stalk中部署Java Spring Boot应用程序
  • i上传应用程序代码和zip格式的jar文件,并更改了代码和AWS的服务器端口
  • 应用程序已部署,但服务器运行状况显示为降级
  • 你能告诉我如何使API成为公共的吗
  • 你们能告诉我你们的建议哪里出错了吗
  • 应用程序代码可在github及其链接中获得:https://github.com/aarivalagan/student-application/blob/master/studentcousr.zip
  • 我在下面附上了应用程序服务器截图:
  • 下面提供部署日志文件和application.properties文件:

    2019/04/01 15:05:39[错误]3712#0:*1连接()失败(111:拒绝连接)时连接到上游,客户端:159.192.220.120,服务器:,请求:“Get/HTTP/1.1”,上游:“http://127.0.0.1:5000/”,主机:“18.221.113.190:80”

    inflating: /var/app/staging/StudentCousr/target/classes/student/service/StudentServiceImpl.class  
    inflating: /var/app/staging/StudentCousr/target/classes/student/SpringBootApp.class  
     creating: /var/app/staging/StudentCousr/target/generated-sources/
     creating: /var/app/staging/StudentCousr/target/generated-sources/annotations/
     creating: /var/app/staging/StudentCousr/target/maven-archiver/
    inflating: /var/app/staging/StudentCousr/target/maven-archiver/pom.properties  
     creating: /var/app/staging/StudentCousr/target/maven-status/
     creating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/
     creating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/compile/
     creating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/compile/default-compile/
    inflating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst  
    inflating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst  
     creating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/testCompile/
     creating: /var/app/staging/StudentCousr/target/maven-status/html" target="_blank">maven-compiler-plugin/testCompile/default-testCompile/
    

    提取:/var/app/staging/studentcousr/target/maven-status/maven-compiler-plugin/testcompile/default-testcompile/inputfiles.lst
    膨胀:/var/app/staging/studentcousr/target/studentcousr/target/studentcousr-0.0.1-snapshot.jar
    膨胀:/var/app/staging/studentcousr/target/studentcousr-0.0.1-snapshot.jar
    创建:/elasticbeanstalk/lib/ruby/bin/foreman export supervisord--procfile/var/app/staging/procfile--root/var/app/current--app application--log/var/log/--user webapp--template/opt/elasticbeanstalk/private/config/foreman/supervisord--env/var/elasticbeanstalk/staging/elasticbeanstalk.env/var/elasticbeanstalk/staging/supervisor[foreman

    正在执行:/opt/elasticbeanstalk/bin/log-conf-n containerlistener-l'/var/log/eb-container-listener.log'-t bundlelogs

    [2019-04-01T15:04:11.783z]信息[3515]-[配置更新stu1-source@2/configdeploystage0/configdeployprehook/01_configure_xray.sh]:正在开始活动...[2019-04-01T15:04:11.889z]信息[3515]-[配置更新stu1-source@2/configdeploystage0/configdeployprehook/01_configure_xray.sh]:已完成活动。[2019-04-01T15:04:11.889z]信息[3515]-[配置更新stu1-source@2/configdeploystage0/configdeployprehook/03_configure_proxy.sh]:正在开始活动...[2019-04-01T15:04:12.058z]信息[3515]-[配置更新stu1-source@2/configdeploystage0/configdeployprehook/03_configure_proxy.sh]:已完成活动。结果:执行:/opt/elasticbeanstalk/bin/log-conf-n nginx-l'/var/log/nginx/*'

    执行:/usr/sbin/nginx-t-c/var/elasticbeanstalk/staging/nginx/nginx.conf nginx:配置文件/var/elasticbeanstalk/staging/nginx/nginx.conf语法正确nginx:配置文件/var/elasticbeanstalk/staging/nginx/nginx.conf测试成功[2019-04-01t15:04:12.058z]信息[3515]-[配置更新stu1-source@2/configdeploystage0/configdeployprehook]:完成活动。结果:在/opt/ellasticbeanstalk/hooks/configdeploy/pre目录中成功执行钩子。[2019-04-01T15:04:12.058z]信息[3515]-[配置更新stu1-source@2/configdeploystage0]:已完成活动。结果:配置更新-命令CMD-ConfigDeploy阶段0完成[2019-04-01T15:04:12.058z]信息[3515]-[配置更新stu1-source@2/configdeploystage1]:开始活动...[2019-04-01T15:04:12.058z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook]:开始活动...[2019-04-01T15:04:12.058z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/01_stop_before_promote.sh]:开始活动...[2019-04-01T15:04:23.684Z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/01_stop_before_promote.sh]:已完成活动。结果:执行:/usr/local/bin/supervisorctl-c/etc/supervisor/supervisord.conf停止应用程序:*

    进程终止时间超过10秒。执行:/usr/local/bin/supervisorctl-c/etc/supervisor/supervisord.conf停止所有监听器:supervisor_listener:停止执行:/sbin/status supervisord supervisord start/running,进程3235执行:/sbin/stostus supervisord supervisord stop/waiting[2019-04-01t15:04:23.684z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/01stop_xray.sh]:开始活动...[2019-04-01T15:04:23.796Z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/01stop_xray.sh]:已完成活动。结果:执行:if(initctl status xray grep start);然后initctl停止X射线;FI

    [2019-04-01T15:04:23.796z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/02start_xray.sh]:正在开始活动...[2019-04-01T15:04:23.900Z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/02start_xray.sh]:已完成活动。[2019-04-01T15:04:23.901Z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/03_stop_proxy.sh]:开始活动...[2019-04-01T15:04:24.114z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/03_stop_proxy.sh]:已完成活动。结果:执行:服务nginx stop stop nginx:[OK][2019-04-01t15:04:24.114z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/07_start_application.sh]:开始活动...[2019-04-01T15:04:24.220z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/07_start_application.sh]:已完成活动。结果:执行:/sbin/start supervisord supervisord start/running,process 3663[2019-04-01t15:04:24.220z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/09_start_proxy.sh]:开始活动...[2019-04-01T15:04:26.803z]信息[3515]-[配置更新stu1-source@2/configdeploystage1/configdeployenacthook/09_start_proxy.sh]:已完成活动。结果:执行:service nginx stop

    执行:service nginx start Starting nginx:[OK]执行:/opt/elasticbeanstalk/bin/healthd-track-pidfile--proxy nginx

    正在执行:/opt/elasticbeanstalk/bin/healthd-configure--appstat-log-path/var/log/nginx/healthd/application.log--appstat-unit sec--appstat-timestamp-on'complinity'

    正在执行:/opt/elasticbeanstalk/bin/healthd-restart

    159.192.220.120--[01/APR/2019:15:05:39+0000]“Get/HTTP/1.1”502 575“-”Mozilla/5.0(Windows NT 6.1;WOW64)AppleWebKit/537.36(KHTML,like Gecko)Chrome/52.0.2743.116 Safari/537.36“-”

    Application.Properties文件

    SERVER_PORT = 5000
    

  • 共有1个答案

    王彭薄
    2023-03-14

    默认情况下,elb使用端口5000,它作为名为port的env变量公开,您需要在应用程序中使用它。

    server_port是一个elb参数,不用于Spring Boot。

    server.PORT=${PORT}放入application.properties中。

    eb setenv server_port=8001

    使用AWS CLI

     类似资料:
    • 目前,我们有一个集群应用程序运行Spring Boot(1.5.2)。有时,命中/health致动器endpoint的健康检查以503响应。但是,日志中没有任何内容表明服务不可用的原因。有没有办法得到一个更准确的原因为什么503是生产?

    • 我们正在OpenShift集群中运行领事。所有服务都是由Spring Boot/Cloud API开发的,并且已经在Consult成功注册。使用SpringBoot执行器暴露了一个健康点。健康点本身的工作只是很好,当尝试使用卷曲击中…有时我们只是得到HTTP200状态代码,却看不到任何响应。这导致Consult经常抛出以下错误,从而导致发现服务时出现问题。 任何建议都会很有帮助。 2016/08/

    • 我知道Spring Boot应用程序可以作为war文件部署到生产环境中。但是部署spring boot应用程序的典型方式是什么?它只需要jvm而不需要容器吗?

    • 根据这篇基于尤里卡服务发现的博客https://spring.io/blog/2015/07/14/microservices-with-spring,服务发现在这里正常工作。 但是当切换到使用Consul而不是Eureka时,服务发现不起作用,并出现以下错误: 更新:在通过提供正确的运行状况检查endpoint(请参阅下面的答案)修复上一个错误后,在bootstrap.yml中正确提供Consu

    • 我有一个使用tomcat服务器运行的java应用程序。现在我需要在jboss服务器上运行相同的应用程序。我是jboss新手,我尝试过在jboss中部署war文件,但没能做到。 我不知道应用程序要在jboss上运行需要做什么更改。任何人请引导我。 非常感谢。

    • 最近,我试图做一个测试部署的Blazor服务器应用程序在本地托管的库伯内特斯实例运行在docker桌面。 我设法在容器中正确启动了应用程序,应用了迁移等,日志告诉我应用程序正在运行并等待。 使用Docker桌面中的< code > Reset Kubernetes k luster 重置Kubernetes后采取的步骤: > 修改<code>hosts</code>文件以包含<code>127.0