简体   繁体   English

AWS Elastic Beanstalk Django 应用程序健康检查问题

[英]AWS Elastic Beanstalk Django application health check problem

I am having a very similar problem to the one described here .我遇到了与此处描述的问题非常相似的问题。 As that question wasn't answered and there are some differences between my problem and the one described there I decided to ask a new question.由于该问题没有得到解答,并且我的问题与那里描述的问题之间存在一些差异,因此我决定提出一个新问题。

I managed to deploy my Django backend API to the AWS Elastic Beanstalk Amazon Linux 2 Python 3.7 platform.我设法将我的 Django 后端 API 部署到 AWS Elastic Beanstalk Amazon Linux 2 Python 3.7 平台。 However, the health status of the EB instance is "Severe".但是,EB 实例的健康状态为“严重”。 It shows the message:它显示消息:

Following services are not running: release.以下服务未运行:发布。

The overall health status is "Degraded" and the message is整体健康状态为“降级”,消息为

Impaired services on all instances.所有实例上的服务受损。

Sometimes a message saying that all responses are 4xx appears.有时会出现一条消息,指出所有响应均为 4xx。 This message comes and goes.这个消息来来去去。 The weird thing is that I have 2 load balancers configured (one for http and the other one for https) and both have a health check path url of a valid url in the application.奇怪的是,我配置了 2 个负载均衡器(一个用于 http,另一个用于 https),并且都具有应用程序中有效 url 的健康检查路径 url。

The only relevant logs I could find are the following:我能找到的唯一相关日志如下:

daemon.log守护进程日志

F, [2020-11-05T00:07:40.486088 #15846] FATAL -- : /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/launcher.rb:432:in `block in setup_signals': SIGTERM (SignalException)
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/single.rb:117:in `join'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/single.rb:117:in `run'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/launcher.rb:172:in `run'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/cli.rb:80:in `run'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/healthd-1.0.6/bin/healthd:112:in `block in <top (required)>'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/healthd-1.0.6/bin/healthd:19:in `chdir'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/healthd-1.0.6/bin/healthd:19:in `<top (required)>'
    from /opt/elasticbeanstalk/lib/ruby/bin/healthd:23:in `load'
    from /opt/elasticbeanstalk/lib/ruby/bin/healthd:23:in `<main>'

web.stdout.log标准输出日志

(...)
Nov  5 09:26:18 ip-172-31-94-128 web: Invalid HTTP_HOST header: '52.86.81.51'. You may need to add '52.86.81.51' to ALLOWED_HOSTS.
Nov  5 09:26:18 ip-172-31-94-128 web: Bad Request: /
Nov  5 09:33:11 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 09:33:11 ip-172-31-94-128 web: Bad Request: /console/
Nov  5 09:33:12 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 09:33:12 ip-172-31-94-128 web: Bad Request: /index.php
Nov  5 09:33:16 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 09:33:16 ip-172-31-94-128 web: Bad Request: /
Nov  5 09:33:16 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 09:33:16 ip-172-31-94-128 web: Bad Request: /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
Nov  5 09:33:17 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 09:33:17 ip-172-31-94-128 web: Bad Request: /api/jsonws/invoke
Nov  5 09:33:20 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 09:33:20 ip-172-31-94-128 web: Bad Request: /solr/admin/info/system
Nov  5 09:33:22 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 09:33:22 ip-172-31-94-128 web: Bad Request: /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
Nov  5 09:33:24 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 09:33:24 ip-172-31-94-128 web: Bad Request: /wp-content/plugins/wp-file-manager/readme.txt
Nov  5 09:33:25 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 09:33:25 ip-172-31-94-128 web: Bad Request: /
Nov  5 09:35:29 ip-172-31-94-128 web: Not Found: /boaform/admin/formLogin
Nov  5 09:35:55 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.212.192.113'. You may need to add '18.212.192.113' to ALLOWED_HOSTS.
Nov  5 09:35:55 ip-172-31-94-128 web: Bad Request: /
Nov  5 09:41:21 ip-172-31-94-128 web: Invalid HTTP_HOST header: '54.243.237.110'. You may need to add '54.243.237.110' to ALLOWED_HOSTS.
Nov  5 09:41:21 ip-172-31-94-128 web: Bad Request: /remote/login
Nov  5 09:46:37 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.212.192.113'. You may need to add '18.212.192.113' to ALLOWED_HOSTS.
Nov  5 09:46:37 ip-172-31-94-128 web: Bad Request: /
Nov  5 09:49:41 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.212.192.113'. You may need to add '18.212.192.113' to ALLOWED_HOSTS.
Nov  5 09:49:41 ip-172-31-94-128 web: Bad Request: /
Nov  5 09:58:26 ip-172-31-94-128 web: Not Found: /
Nov  5 09:59:35 ip-172-31-94-128 web: Invalid HTTP_HOST header: '34.236.195.107'. You may need to add '34.236.195.107' to ALLOWED_HOSTS.
Nov  5 09:59:35 ip-172-31-94-128 web: Bad Request: /
Nov  5 09:59:35 ip-172-31-94-128 web: Invalid HTTP_HOST header: '34.236.195.107'. You may need to add '34.236.195.107' to ALLOWED_HOSTS.
Nov  5 09:59:35 ip-172-31-94-128 web: Bad Request: /
Nov  5 10:09:52 ip-172-31-94-128 web: Invalid HTTP_HOST header: '52.86.81.51'. You may need to add '52.86.81.51' to ALLOWED_HOSTS.
Nov  5 10:09:52 ip-172-31-94-128 web: Bad Request: /
Nov  5 10:10:35 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.212.192.113'. You may need to add '18.212.192.113' to ALLOWED_HOSTS.
Nov  5 10:10:35 ip-172-31-94-128 web: Bad Request: /
Nov  5 10:10:38 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.212.192.113'. You may need to add '18.212.192.113' to ALLOWED_HOSTS.
Nov  5 10:10:38 ip-172-31-94-128 web: Bad Request: /
Nov  5 10:20:03 ip-172-31-94-128 web: Invalid HTTP_HOST header: '52.86.81.51'. You may need to add '52.86.81.51' to ALLOWED_HOSTS.
Nov  5 10:20:03 ip-172-31-94-128 web: Bad Request: /
Nov  5 10:23:53 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 10:23:53 ip-172-31-94-128 web: Bad Request: /remote/login
Nov  5 10:36:49 ip-172-31-94-128 web: Invalid HTTP_HOST header: '34.236.195.107'. You may need to add '34.236.195.107' to ALLOWED_HOSTS.
Nov  5 10:36:49 ip-172-31-94-128 web: Bad Request: /
Nov  5 10:38:39 ip-172-31-94-128 web: Invalid HTTP_HOST header: '54.243.237.110'. You may need to add '54.243.237.110' to ALLOWED_HOSTS.
Nov  5 10:38:39 ip-172-31-94-128 web: Bad Request: /
Nov  5 10:42:26 ip-172-31-94-128 web: Not Found: /
Nov  5 10:42:49 ip-172-31-94-128 web: Invalid HTTP_HOST header: '52.86.81.51'. You may need to add '52.86.81.51' to ALLOWED_HOSTS.
Nov  5 10:42:49 ip-172-31-94-128 web: Bad Request: /
Nov  5 10:42:49 ip-172-31-94-128 web: Invalid HTTP_HOST header: '52.86.81.51'. You may need to add '52.86.81.51' to ALLOWED_HOSTS.
Nov  5 10:42:49 ip-172-31-94-128 web: Bad Request: /
Nov  5 11:05:54 ip-172-31-94-128 web: Invalid HTTP_HOST header: '18.210.4.127'. You may need to add '18.210.4.127' to ALLOWED_HOSTS.
Nov  5 11:05:54 ip-172-31-94-128 web: Bad Request: /

I have no clue what the error in the daemon.log means.我不知道 daemon.log 中的错误是什么意思。 I have googled the error and found nothing relevant.我在谷歌上搜索了错误并没有发现任何相关内容。 On the other hand, I don't understand why the requests that appear in the web.stdout.log are being made.另一方面,我不明白为什么会发出 web.stdout.log 中出现的请求。 The IP addresses that originated the request are all from Virginia US (region where my server is hosted), so I'm guessing the requests where made by some AWS resource.发起请求的 IP 地址都来自美国弗吉尼亚州(我的服务器托管的区域),所以我猜测某些 AWS 资源发出的请求。 The weird thing is the routes to which the requests were made: none of them exists in my application.奇怪的是发出请求的路由:它们都不存在于我的应用程序中。

Any help is very much appreciated.很感谢任何形式的帮助。 Thank you in advance.先感谢您。

Quick solution:快速解决方案:

You need to add * in project's settings.pyALLOWED_HOSTS您需要在项目的settings.py添加*ALLOWED_HOSTS

ALLOWED_HOSTS = ['*']

Long solution:长解决方案:

Looks like your IP address is dynamic so you need to access by domain name and not IP or you need to allow all IPs, what means Quick solution .看起来您的IP地址是动态的,因此您需要通过域名而不是IP访问,或者您需要允许所有IP,这意味着快速解决方案

Explanation here 此处说明
Same problem同样的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM