Django/Celery:除非重新启动,否则 celeryd 不会从队列中检索新任务
我不明白为什么 celeryd 没有拉取添加到队列中的新任务。它只会在启动后检索任务,然后无法监视。我正在使用 Django ORM 作为消息代理,通过 django-celery 运行 Django 开发服务器。
我的 Django 设置文件具有以下 celery 配置:
INSTALLED_APPS += ("djcelery", )
INSTALLED_APPS += ("djkombu", )
import djcelery
djcelery.setup_loader()
BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"
BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "guest"
BROKER_PASSWORD = "guest"
BROKER_VHOST = "/"
此外,如果重要的话,我使用远程 MySQL 服务器作为我的数据库后端。
编辑:已解决!
花了几个小时解决这个问题后,我在 Celery 常见问题解答中找到了答案:
我没有在日志中看到死锁错误,但是修改我的/etc/my.cnf
包含:
[mysqld]
transaction-isolation = READ-COMMITTED
解决了我的问题。
希望这对其他人有帮助!
I cannot figure out why celeryd
is not pulling new tasks that are added to the queue. It will only retrieve tasks once it is started, then fails to monitor thereafter. I am running the Django development server with django-celery using the Django ORM for the message broker.
My Django settings file has this configuration for celery:
INSTALLED_APPS += ("djcelery", )
INSTALLED_APPS += ("djkombu", )
import djcelery
djcelery.setup_loader()
BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"
BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "guest"
BROKER_PASSWORD = "guest"
BROKER_VHOST = "/"
Furthermore if it matters, I am using a remote MySQL server as my database backend.
Edit: Resolved!
After spending several hours on this, I found an answer in the Celery FAQ:
MySQL is throwing deadlock errors, what can I do?
I wasn't seeing the deadlock errors in the log, but modifying my /etc/my.cnf
to include:
[mysqld]
transaction-isolation = READ-COMMITTED
resolved my issue.
Hope this helps someone else!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
花了几个小时研究这个问题后,我在 Celery FAQ 中找到了答案:
我没有在日志中看到死锁错误,而是修改我的 /etc/my.cnf 以包括:
[mysqld]
transaction-isolation = READ-COMMITTED
解决了我的问题。
希望这对其他人有帮助!
After spending several hours on this, I found an answer in the Celery FAQ:
I wasn't seeing the deadlock errors in the log, but modifying my /etc/my.cnf to include:
[mysqld]
transaction-isolation = READ-COMMITTED
resolved my issue.
Hope this helps someone else!