【问题标题】:how to detect failure and auto restart celery worker如何检测故障并自动重启 celery worker
【发布时间】:2019-07-18 14:12:45
【问题描述】:

我在我的 django 网站中使用 CeleryCelerybeat。服务器操作系统是 Ubuntu 16.04。通过使用 celerybeat,芹菜工人每 10 分钟完成一项工作。有时工作人员会在没有任何有用的日志消息或错误的情况下关闭。 所以,我想找到一种方法来检测芹菜工人(不是 Beat)的状态(开/关),如果它停止了,就自动重新启动它。 我怎样才能做到这一点? 谢谢

【问题讨论】:

    标签: linux cron celery django-celery celerybeat


    【解决方案1】:

    在生产中,您应该使用 Supervisor/Upstart/Systemd/.../.. 作为守护进程 [1] 运行 Celery、Beat、您的 APP 服务器等。在 Celery 文档中有一个关于此的部分。 [2]

    我最喜欢的工具是 Supervisord [3]。这里是 Celery 的 Supervisord 示例配置:https://github.com/celery/celery/tree/master/extra/supervisord,这里 https://github.com/illagrenan/ubuntu-supervisor-configuration 是关于在 Ubuntu 上安装 Supervisord 的教程。

    (...) Supervisord 将进程作为其子进程启动,并且可以 配置为在崩溃时自动重新启动它们。 (...)

    来源:http://supervisord.org/introduction.html#introduction

    【讨论】:

      猜你喜欢
      • 2014-12-24
      • 1970-01-01
      • 2017-11-29
      • 1970-01-01
      • 2014-11-22
      • 1970-01-01
      • 1970-01-01
      • 2021-01-10
      • 1970-01-01
      相关资源
      最近更新 更多