AWS Elastic Beanstalk-Apache 不断重启

AWS Elastic Beanstalk-Apache 不断重启

我已经在 AWS Elastic Beanstalk 上部署了一个 Django 应用程序。最近我遇到了 Apache 问题,因为它经常重启。

查看我的 Elastic Beanstalk 仪表板

最初查看文件 /var/log/httpd/error_log 时我收到以下错误:

[Wed Apr 12 08:50:51.371533 2017] [mpm_prefork:error] [pid 17847] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

因此我按如下方式配置了 Apache:

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
KeepAlive On

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
MaxKeepAliveRequests 500

# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
KeepAliveTimeout 20

<IfModule mpm_prefork_module>
    ServerLimit 60
    MaxRequestWorkers 1000
    StartServers 18
    MinSpareServers 3
    MaxSpareServers 6
    MaxConnectionsPerChild 1000
    ListenBacklog 1000
</IfModule>

问题并没有解决,错误如下:

[Tue Apr 18 00:15:23.037564 2017] [mpm_prefork:error] [pid 7816] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
...
[Tue Apr 18 03:01:01.786908 2017] [mpm_prefork:notice] [pid 7816] AH00173: SIGHUP received.  Attempting to restart
[Tue Apr 18 03:01:01.851941 2017] [so:warn] [pid 7816] AH01574: module wsgi_module is already loaded, skipping
[Tue Apr 18 03:01:01.874858 2017] [mpm_prefork:warn] [pid 7816] AH00181: MaxRequestWorkers of 1000 exceeds ServerLimit value of 60, decreasing to match
[Tue Apr 18 03:01:01.875556 2017] [auth_digest:notice] [pid 7816] AH01757: generating secret for digest authentication ...
[Tue Apr 18 03:01:01.876190 2017] [lbmethod_heartbeat:notice] [pid 7816] AH02282: No slotmem from mod_heartmonitor
[Tue Apr 18 03:01:01.927425 2017] [mpm_prefork:notice] [pid 7816] AH00163: Apache/2.4.25 (Amazon) mod_wsgi/3.5 Python/3.4.3 configured -- resuming normal operations
[Tue Apr 18 03:01:01.927452 2017] [core:notice] [pid 7816] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

更新:

ServerLimit必须大于或等于MaxRequestWorkers

<IfModule mpm_prefork_module>
    ServerLimit 1000
    MaxRequestWorkers 1000
    StartServers 18
    MinSpareServers 3
    MaxSpareServers 6
    MaxConnectionsPerChild 1000
    ListenBacklog 1000
</IfModule>

现在,我不再收到mpm_prefork错误/警告,并且 Apache 也不再关闭。

相关内容