20

我使用主管来运行 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
4

4 回答 4

41

默认情况下,主管在停止时发送 SIGTERM。uWSGI 中的 SIGTERM 表示“残酷的重新加载”。

您必须将其更改为 QUIT 或 INT:

停止信号=退出

应该够了

另一种方法(不鼓励)是将 --die-on-term 添加到 uWSGI 命令行以更改其默认行为

于 2013-10-22T10:13:43.333 回答
4
  1. 项目主管配置文件

    添加stopsignal=INT

  2. 项目uwsgi配置文件

    删除daemonize=xxx.log以禁用守护程序模式

于 2015-12-28T06:52:05.157 回答
4

如果您在 uwsgi 配置中使用“processes = #”,则还必须使用“master = true”。如果没有,主管只会杀死一名工人。

然后:

/etc/supervisor/conf.d/app.conf

stopsignal = QUIT

/etc/uwsgi/app.ini

processes = 4
master = true
于 2016-07-13T21:46:58.593 回答
1

如果你使用 master 和 workers 运行你的 UWSGI,你需要在你的/etc/supervisor/conf.d/app.conf文件中添加

stopasgroup=false
killasgroup=false

否则无论什么停止 uwsgi 都会产生更多的主人,工人也是如此。

于 2018-04-24T13:44:59.857 回答