我设置rabbitmqserver并使用以下步骤添加了用户:
uruddarraju@*******:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.3$ sudo rabbitmqctl list_users Listing users ... guest [administrator] phantom [administrator] phantom1 [] sudo rabbitmqctl set_permissions -p phantom phantom1 ".*" ".*" ".*" uruddarraju@******:/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.3$ sudo netstat -tulpn | grep :5672 tcp6 0 0 :::5672 :::* LISTEN 31341/beam.smp
我的celery配置是这样的:
BROKER_URL = 'amqp://phantom:phantom1@10.98.85.92/phantom'
我的代码是这样的:
__author__ = 'uruddarraju' from celery import Celery import time import celeryconfig app = Celery('tasks') app.config_from_object(celeryconfig) @app.task def add(x, y): print 'sleeping' time.sleep(20) print 'awoke' return x + y
当我尝试跑步时
celery -A celery worker --loglevel=info
我懂了
[2014-07-08 23:30:05,028: ERROR/MainProcess] consumer: Cannot connect to amqp://phantom:**@10.98.85.92:5672/phantom: [Errno 54] Connection reset by peer. Trying again in 2.00 seconds... [2014-07-08 23:30:07,101: ERROR/MainProcess] consumer: Cannot connect to amqp://phantom:**@10.98.85.92:5672/phantom: [Errno 54] Connection reset by peer. Trying again in 4.00 seconds...
一切看起来都很完美!有人可以帮我我在这里想念的吗?
一旦我将代码部署到生产环境并将Celery升级到3.1.12,问题就解决了。我最初使用3.0.19,但后来进行了升级,但没有发现任何问题。感谢您的支持。