如何在远程系统上配置和运行芹菜工作者 [英] how to configure and run celery worker on remote system

查看:85
本文介绍了如何在远程系统上配置和运行芹菜工作者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在芹菜处理和使用rabbitmq服务器,并在服务器中的django项目中创建了一个项目(消息队列,数据库存在),并且它工作正常,我已经创建了多个工作人员

i am working on celery and using rabbitmq server and created a project in django project in a server(where message queue,database exists) and it is working fine, i have created multiple workers also

from kombu import Exchange, Queue
CELERY_CONCURRENCY = 8

CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']

CELERY_RESULT_BACKEND = 'amqp'
CELERYD_HIJACK_ROOT_LOGGER = True
CELERY_HIJACK_ROOT_LOGGER = True
BROKER_URL = 'amqp://guest:guest@localhost:5672//'

CELERY_QUEUES = (
  Queue('default', Exchange('default'), routing_key='default'),
  Queue('q1', Exchange('A'), routing_key='routingKey1'),
  Queue('q2', Exchange('B'), routing_key='routingKey2'),
)
CELERY_ROUTES = {
 'my_taskA': {'queue': 'q1', 'routing_key': 'routingKey1'},
 'my_taskB': {'queue': 'q2', 'routing_key': 'routingKey2'},
}


AMQP_SERVER = "127.0.0.1"
AMQP_PORT = 5672
AMQP_USER = "guest"
AMQP_PASSWORD = "guest"
AMQP_VHOST = "/"`


CELERY_INCLUDE = ('functions')

`

但是我想从另一台服务器运行工作人员。我需要一些有关如何运行工作人员的信息在另一个系统中,当我提到几个网站时,它说我们需要在远程系统上运行django项目也是必要的?

but i want to run workers from another server.so i need some information regarding how to run a worker in another system when i referred few sites it is saying that we need to run the django project on the remote system also is it necessary?

推荐答案

这是这个想法的要点:

机器A上


  1. 安装Celery& RabbitMQ。

  2. 配置rabbitmq,使机器B可以连接到它。

  3. 创建一个my_tasks.py,并将一些任务放在队列中。 / li>
  1. Install Celery & RabbitMQ.
  2. Configure rabbitmq so that Machine B can connect to it.
  3. Create my_tasks.py with some tasks and put some tasks in queue.

机器B上


  1. 安装Celery。

  2. 将my_tasks.py文件从机器A复制到本机。

  3. 运行一个工作程序来使用任务

我有同样的要求,并尝试芹菜。这样做容易得多几天后我写了一篇详细的博客文章。查看如何将任务发送到远程计算机?

I had the same requirement and experimented with celery. It is a lot easier to do that. I wrote a detailed blog post on that few days back. Check out how to send tasks to remote machine?

这篇关于如何在远程系统上配置和运行芹菜工作者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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