以django和兔子为经纪人的芹菜正在跳过每一项备用任务

时间:2016-02-15 10:14:29

标签: django rabbitmq celery

我正在使用芹菜为我的django应用程序做后台工作,并将rabbitmq作为经纪人。但我在制作中遇到了奇怪的问题。无论我发起什么任务,每个替代任务都会被跳过,没有任何痕迹。相同的设置在我的开发环境中正常工作。

我能想到的唯一原因是可能有另一个消费者正在消费消息,但我无法弄明白。我正在使用默认的兔子配置文件,并创建了一个单独的用户和虚拟主机。

我甚至找不到与此相关的任何内容,任何帮助都将受到高度赞赏。

这是rabbitmqctl status命令的输出

Status of node 'rabbit@ip-172-31-21-247' ...
[{pid,22526},
 {running_applications,
 [{rabbitmq_management,"RabbitMQ Management Console","3.2.4"},
  {rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.2.4"},
  {webmachine,"webmachine","1.10.3-rmq3.2.4-gite9359c7"},
  {mochiweb,"MochiMedia Web Server","2.7.0-rmq3.2.4-git680dba8"},
  {rabbitmq_management_agent,"RabbitMQ Management Agent","3.2.4"},
  {rabbit,"RabbitMQ","3.2.4"},
  {os_mon,"CPO  CXC 138 46","2.2.14"},
  {inets,"INETS  CXC 138 49","5.9.7"},
  {mnesia,"MNESIA  CXC 138 12","4.11"},
  {amqp_client,"RabbitMQ AMQP Client","3.2.4"},
  {xmerl,"XML parser","1.3.5"},
  {sasl,"SASL  CXC 138 11","2.3.4"},
  {stdlib,"ERTS  CXC 138 10","1.19.4"},
  {kernel,"ERTS  CXC 138 10","2.16.4"}]},
 {os,{unix,linux}},
 {erlang_version,
 "Erlang R16B03 (erts-5.10.4) [source] [64-bit] [smp:2:2] [async-threads:30]        [kernel-poll:true]\n"},
 {memory,
 [{total,79683424},
  {connection_procs,1040632},
  {queue_procs,316520},
  {plugins,-381968},
  {other_proc,14279336},
  {mnesia,78184},
  {mgmt_db,1332496},
  {msg_index,41792},
  {other_ets,1129440},
  {binary,36806032},
  {code,20026884},
  {atom,703377},
  {other_system,4310699}]},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,1578945740},
 {disk_free_limit,50000000},
 {disk_free,3877945344},
 {file_descriptors,
 [{total_limit,924},
  {total_used,18},
  {sockets_limit,829},
  {sockets_used,15}]},
 {processes,[{limit,1048576},{used,341}]},
 {run_queue,0},
 {uptime,47427}]
...done.

由于 阿努拉格

2 个答案:

答案 0 :(得分:3)

检查是否有一个正在消耗工作的某个地方运行的恶意工作进程。我建议停止所有芹菜工作(使用systemctl,supervisorctl或其他),在所有机器上使用pgrep芹菜来检查是否有任何工人遗留下来。

答案 1 :(得分:1)

我遇到了类似的问题,原因与提到的狡猾的一样。但这不是一个额外的流氓工人流程,而是另一个芹菜流程连接到同一个rabbitmq uri。在这种情况下,您应该将任务路由到正确的工作人员。如果您没有定义任何路由规则,则所有任务都将在默认路由之后执行,并且由于工作人员没有发现其他工作人员的任务,您将获得关键错误并且任务将丢失。

以下是Celery路由的文档;

http://docs.celeryproject.org/en/latest/userguide/routing.html