我使用主管来运行uWSGI应用程序。为什么uWSGI应用程序在停止主管后并不总是停止? 主管配置:
[program:test]
autostart = true
user=root
command=uwsgi --master --workers 5 --disable-logging --socket 127.0.0.1:8888
--module web --callable app
priority=1
redirect_stderr=true
stdout_logfile = /data/log
答案 0 :(得分:37)
默认情况下,主管在停止时发送SIGTERM。 uWSGI中的SIGTERM意味着“残酷的重新加载”。
您必须将其更改为QUIT或INT:
stopsignal = QUIT
应该足够了
另一种方法(不鼓励)是在uWSGI命令行中添加--die-on-term来改变其默认行为
答案 1 :(得分:4)
添加
stopsignal=INT
删除
daemonize=xxx.log
以禁用守护程序模式
答案 2 :(得分:4)
如果您使用" processes =#"进入你的uwsgi配置,你还必须使用" master = true"。如果没有,主管只会杀死一名工人。
然后:
/etc/supervisor/conf.d/app.conf
stopsignal = QUIT
/etc/uwsgi/app.ini
processes = 4
master = true
答案 3 :(得分:1)
如果您使用主人和工作人员运行UWSGI,则需要添加/etc/supervisor/conf.d/app.conf
文件
stopasgroup=false
killasgroup=false
或者无论什么停止uwsgi会产生更多的主人,工人也是如此。