我有一个由芹菜服务器和工作人员组成的网络,它们将用于即将到来的大量 I/O 任务。有两个队列,default
和backlog
,每台服务器有五个工作人员。所有服务器都使用类似于init 脚本配置文档的配置进行守护。
我想为一台服务器做的是让三个工作人员default
为backlog
. 是否可以使用守护程序配置来做到这一点?
在这部分中查看这里,它向您展示了一个示例配置,它还说:
# Names of nodes to start
# most people will only start one node:
CELERYD_NODES="worker1"
# but you can also start multiple and configure settings
# for each in CELERYD_OPTS (see `celery multi --help` for examples):
如您所见,可以让 celeryd 启动多个节点,您可以通过 CELERYD_OPTS 配置每个节点,因此您可以为每个节点设置不同的队列。
在这里,您找到了另一个更完整的 celery multi 示例,我在这里发布了一些摘录。
# Advanced example starting 10 workers in the background:
# * Three of the workers processes the images and video queue
# * Two of the workers processes the data queue with loglevel DEBUG
# * the rest processes the default' queue.
$ celery multi start 10 -l INFO -Q:1-3 images,video -Q:4,5 data
-Q default -L:4,5 DEBUG