带有 Django 的 RabbitMQ/Celery 挂起延迟/就绪/等 - 没有有用的日志信息

时间:2023-02-14
本文介绍了带有 Django 的 RabbitMQ/Celery 挂起延迟/就绪/等 - 没有有用的日志信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

所以我只是设置了 celery 和 rabbitmq,创建了我的用户,设置了虚拟主机,将用户映射到虚拟主机,并成功运行了 celery 守护程序(或者我假设)

(queuetest)corky@corky-server:~/projects/queuetest$ ./manage.py celerydcelery@corky-server v0.9.5 正在启动.配置->.经纪人->amqp://celery@localhost:5672/.队列->.芹菜->交换:芹菜(直接)绑定:芹菜.并发->2.装载机->celery.loaders.djangoapp.日志文件->[stderr]@警告.事件->离开.击败->离开芹菜开始了.

我创建了一个celery"用户,因为在这种情况下我感觉不是很有创造力.

当我尝试在 celery 文档中做一个简单的例子时:

>>>从任务导入添加>>>r = add.delay(2, 2)>>>r<异步结果:16235ea3-c7d6-4cce-9387-5c6285312c7c>>>>r.ready()(永远挂着.)

所以我检查了常见问题解答,想知道还有什么问题,它告诉我这是由于用户权限引起的常见错误,所以我检查了三次,没有,创建另一个新用户,仍然没有.如果我从 carrot.connection 导入 DjangoBrokerConnection 并获取信息,它与我的 celery 设置中的内容相匹配.用于检查您的日志文件的常见问题解答.

我的 rabbit.log 文件在这种情况下不是很有帮助,只是显示:

=INFO REPORT==== 26-Jan-2010::11:58:22 ===接受来自 127.0.0.1:60572 的 0.0.0.0:5672 上的 TCP 连接=信息报告==== 2010 年 1 月 26 日::11:58:22 ===启动 TCP 连接 <0.1120.0>从 127.0.0.1:60572

等等.在这一点上,我不知道我还有什么问题.我正在运行 Ubuntu Jaunty 并从 apt-get 安装了 RabbitMQ.

提前感谢您的帮助.

解决方案

我刚刚修复了一个非常丑陋的错误,该错误只会出现在可能导致此问题的新用户身上.(http://github.com/ask/celery/commit/a9c1316b15055b67ee3c38d294461fa82ed6d2b5)/p>

请从 github 的 master 分支中提取.如果它仍然不起作用你可能必须停止rabbitmq,删除rabbitmq数据库目录(通常是/var/lib/rabbitmq)并重新启动rabbitmq)

真的很抱歉给您带来不便.出现这个错误是因为我们最近将消费者路由密钥选项的名称更改为绑定密钥",但 amqp 库仍然使用 routing_key,我们忘记了重写该选项.

So I just setup celery and rabbitmq, created my user, setup the vhost, mapped the user to the vhost, and ran the celery daemon succesfully (or so I assume)

(queuetest)corky@corky-server:~/projects/queuetest$ ./manage.py celeryd
 celery@corky-server v0.9.5 is starting.
 Configuration ->
. broker -> amqp://celery@localhost:5672/
. queues ->
. celery -> exchange:celery (direct) binding:celery
. concurrency -> 2
. loader -> celery.loaders.djangoapp
. logfile -> [stderr]@WARNING
. events -> OFF
. beat -> OFF

Celery has started.

I created a user of "celery" because I wasn't feeling very inventive in this case.

When I try to do one of the simple examples within the celery docs:

>>> from tasks import add
>>> r = add.delay(2, 2)
>>> r
<AsyncResult: 16235ea3-c7d6-4cce-9387-5c6285312c7c>
>>> r.ready()
(hangs for eternity.)

So I checked the FAQ wondering what else could be up and it told me this is a common bug due to user permissions, so I triple checked those, nothing, made another new user, still nothing. If I import DjangoBrokerConnection from carrot.connection and get the information, it matches up with what's in my celery settings. The FAQ stated to check your log file.

My rabbit.log file isn't very helpful in this situation, simply showing:

=INFO REPORT==== 26-Jan-2010::11:58:22 ===
accepted TCP connection on 0.0.0.0:5672 from 127.0.0.1:60572

=INFO REPORT==== 26-Jan-2010::11:58:22 ===
starting TCP connection <0.1120.0> from 127.0.0.1:60572

And so forth. At this point, I'm at a loss as to what else my problem could be. I'm running Ubuntu Jaunty and installed RabbitMQ from apt-get.

Thanks in advance for any help.

解决方案

I just fixed a really ugly bug that would only show up for new users that would have caused this. (http://github.com/ask/celery/commit/a9c1316b15055b67ee3c38d294461fa82ed6d2b5)

Please pull from the master branch at github. If it still doesn't work you probably have to stop rabbitmq, remove the rabbitmq database directory (usually /var/lib/rabbitmq) and start rabbitmq again)

Really sorry for the inconvenience. The bug happened because we recently changed the name of the consumers routing key option to "binding key", but the amqp libraries still use routing_key and we forgot to rewrite the option.

这篇关于带有 Django 的 RabbitMQ/Celery 挂起延迟/就绪/等 - 没有有用的日志信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:通知芹菜任务工人关闭 下一篇:使用 pika 发布消息时如何添加标头键:值对

相关文章

最新文章