【问题标题】:uWSGI Emperor does not reload Vassal by touching the .ini fileuWSGI Emperor 不会通过触摸 .ini 文件来重新加载 Vassal
【发布时间】:2019-01-14 23:49:21
【问题描述】:

我有多个 uWSGI 封臣,都由 uwsgi Emperor 监控。我更新了我的应用程序 (Django) 的代码,我希望皇帝对其中一个封臣执行干净的重新加载。为此,我

touch vassal-foo.ini

在日志中我看到[emperor] reload the uwsgi instance vassal-foo.ini。这听起来很有希望,但应用程序没有重新加载。它继续运行旧版本。检查进程(PID)启动时间,确实没有重启过。

任何提示可能导致这种情况?一些可能不常见的事情:

  • 皇帝和附庸都不是在主人模式下运行
  • Emperor 使用 pip 安装并在 initctl 下运行
  • kill -9-ing 附庸触发正确的重新加载(显然)
  • 我使用符号链接
  • 我的 python 应用程序 (threading.Thread(target).start()) 中有一个辅助线程,使用 daemon=True 运行

我尝试过但没有成功的方法:

  • 在没有任何额外线程的情况下运行进程(删除threading.Thread(target).start()
  • 接触touch --no-dereference vassal-foo.ini
  • --emperor-nofollow开头的皇帝

vassal-foo.ini:

master         = false
processes      = 1
thunder-lock   = true
enable-threads = true
socket         = /tmp/%n.sock
chmod-socket    = 666
vacuum          = true

皇帝:

exec /tmp/uwsgi --emperor /tmp/configs/uwsgi/ --die-on-term --uid me --gid me --logto /tmp/logs/uwsgi-emperor.log

uWSGI 版本

$ uwsgi --version
2.0.17

【问题讨论】:

  • 也许可以试试touch --no-dereference <INI_FILE>?这将更改实际文件的时间戳,而不是符号链接
  • 也试过了。还尝试修改文件本身。
  • 根据文档,您可能希望使用--emperor-nofollow 选项启动皇帝。来自文档的文本:Finally, start the Emperor with the --emperor-nofollow option. Now you can reload each vassal separately with the command: touch --no-dereference $INI_FILE
  • --emperor-nofollow 选项也没有帮助。
  • 尝试将此添加到您的 uwsgi 配置中 - touch-reload = /path/to/file/vassal-foo.ini。然后重新启动你的 uwsgi 进程,看看它是否有效。

标签: python django uwsgi


【解决方案1】:

问题是你的vassal没有在master模式下运行。

uwsgi 重新加载的所有方式都需要主进程。

在皇帝模式下,当你触摸ini时,皇帝会向vassal发出一声叹息,并在日志中记录vassal正在重新加载。但如果封臣没有主人,它就会忽略叹息。这就是为什么您在日志中看到重新加载但什么也没发生的原因。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-13
    • 2017-05-14
    • 1970-01-01
    • 1970-01-01
    • 2015-03-04
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    相关资源
    最近更新 更多