AWS Elastic Beanstalk Django应用程序运行状况检查问题 [英] AWS Elastic Beanstalk Django application health check problem

查看:117
本文介绍了AWS Elastic Beanstalk Django应用程序运行状况检查问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题与描述的问题非常相似

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.

我设法将Django后端API部署到AWS Elastic Beanstalk Amazon Linux 2 Python 3.7平台.然而,EB实例的健康状态为严重".它显示消息:

I managed to deploy my Django backend API to the AWS Elastic Beanstalk Amazon Linux 2 Python 3.7 platform. However, the health status of the EB instance is "Severe". 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.

有时会出现一条消息,指出所有响应均为4xx.此消息来去去去.奇怪的是,我配置了2个负载平衡器(一个用于http,另一个用于https),并且都具有应用程序中有效url的运行状况检查路径url.

Sometimes a message saying that all responses are 4xx appears. 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.

我唯一能找到的相关日志如下:

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: /

我不知道daemon.log中的错误是什么意思.我已经搜索了该错误,但没有发现任何相关内容.另一方面,我不明白为什么要发出出现在web.stdout.log中的请求.发出请求的IP地址全部来自美国弗吉尼亚州(托管我的服务器的区域),因此我猜测该请求是由某些AWS资源发出的.奇怪的是,发出请求的路径:我的应用程序中不存在这些请求.

I have no clue what the error in the daemon.log means. 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. 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. 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.

推荐答案

快速解决方案:

您需要在项目的 settings.py ALLOWED_HOSTS

ALLOWED_HOSTS = ['*']

长期解决方案:

好像您的IP地址是动态的,因此您需要按域名而不是IP进行访问,或者需要允许所有IP,这意味着快速解决方案.

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.

说明此处
相同的问题

这篇关于AWS Elastic Beanstalk Django应用程序运行状况检查问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆