如何在不同的机器上设置芹菜工人? [英] How to set up celery workers on separate machines?

查看:51
本文介绍了如何在不同的机器上设置芹菜工人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是celery的新手。我知道如何安装和运行一台服务器,但是我需要将任务分发到多台计算机上。
我的项目使用celery将传递到Web框架的用户请求分配给不同的计算机,然后返回结果。
我阅读了文档,但没有提到如何设置多台计算机。
我缺少什么?

I am new to celery.I know how to install and run one server but I need to distribute the task to multiple machines. My project uses celery to assign user requests passing to a web framework to different machines and then returns the result. I read the documentation but there it doesn't mention how to set up multiple machines. What am I missing?

推荐答案

我的理解是,您的应用会将请求推送到排队系统中(例如,rabbitMQ ),然后您可以在不同的计算机上启动任意数量的工作程序(可以访问与提交任务的应用程序相同的代码)。他们将从消息队列中挑选出任务,然后开始处理它们。完成后,他们将更新逻辑删除数据库。

My understanding is that your app will push requests into a queueing system (e.g. rabbitMQ) and then you can start any number of workers on different machines (with access to the same code as the app which submitted the task). They will pick out tasks from the message queue and then get to work on them. Once they're done, they will update the tombstone database.

这样做的结果是,您不必为启动多个工作人员而做任何特殊的事情。只需在单独的相同(相同的源树)计算机上启动它们。

The upshot of this is that you don't have to do anything special to start multiple workers. Just start them on separate identical (same source tree) machines.

具有消息队列的服务器不必与带有工人队列的服务器相同,也不必与提交作业的计算机相同。您只需要将消息队列的位置放在 celeryconfig.py 中,所有计算机上的所有工作程序都可以从队列中提取作业以执行任务。

The server which has the message queue need not be the same as the one with the workers and needn't be the same as the machines which submit jobs. You just need to put the location of the message queue in your celeryconfig.py and all the workers on all the machines can pick up jobs from the queue to perform tasks.

这篇关于如何在不同的机器上设置芹菜工人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆