【发布时间】:2018-01-08 07:32:24
【问题描述】:
我在 ubuntu 16 上使用 uwsgi 和 systemd。
我从这里按照每个应用程序一项服务下的说明进行操作:http://uwsgi-docs.readthedocs.io/en/latest/Systemd.html
如果我启动 systemd 套接字并访问该站点,一切正常。 但是在空闲时间(在 ini 文件中指定)之后,uwsgi 进程被终止,进一步的请求似乎不会重新启动/重新激活进程。
workers have been inactive for more than 30 seconds (1501589319-1501589288)
SIGINT/SIGQUIT received...killing workers...
worker 1 buried after 1 seconds
worker 2 buried after 1 seconds
goodbye to uWSGI.
这是我的 ini 文件:
[uwsgi]
module = wsgi
logto = /tmp/uwsgi.log
master = true
processes = 2
cheap = true
idle = 30
die-on-idle = true
manage-script-name = true
这是我的 systemd 套接字配置:
[Unit]
Description=Socket for uWSGI app
[Socket]
ListenStream=/var/run/uwsgi/myapp.socket
SocketUser=www-data
SocketGroup=www-data
SocketMode=0666
[Install]
WantedBy=sockets.target
这是我的 systemd 服务配置:
[Unit]
Description=uWSGI app
After=syslog.target
[Service]
ExecStart=/home/myapp/venv/bin/uwsgi \
--ini /home/myapp/uwsgi/uwsgi.ini \
--socket /var/run/uwsgi/myapp.socket
User=www-data
Group=www-data
Restart=on-failure
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all
RuntimeDirectory=uwsgi
WorkingDirectory=/home/myapp
【问题讨论】: