为什么Celery会劝阻worker一起打?

Why does Celery discourage worker & beat together?

来自芹菜帮助功能:

> celery worker -h

...

Embedded Beat Options:
  -B, --beat            Also run the celery beat periodic task scheduler. Please note that there must only be
                        one instance of this service. .. note:: -B is meant to be used for development
                        purposes. For production environment, you need to start celery beat separately.

这也出现在 the docs

You can also embed beat inside the worker by enabling the workers -B option, this is convenient if you’ll never run more than one worker node, but it’s not commonly used and for that reason isn’t recommended for production use:

celery -A proj worker -B

但实际上并没有解释为什么 "bad" 在生产中使用它。希望有一些见解。

--beat 选项将与 worker 一起启动节拍调度程序。

但是你只需要一个节拍调度器。

在生产环境中,通常会有多个worker 运行ning。使用 --beat 选项将是一场灾难。

For example: you have a event scheduled at 12:am each day.

If you started two beat process, the event will run twice at 12:am each day.

如果您永远不会 运行 多个工作节点,--beat 选项就好了。