celery使用rabbitmq报错[Errno 104] Connection reset by peer.

写好celery任务文件,使用celery -A app worker --loglevel=info启动时,报告以下错误:redis

[2019-01-29 01:19:26,680: ERROR/MainProcess] consumer: Cannot connect to amqp://sunlight:**@127.0.0.1:5672/celery: [Errno 104] Connection reset by peer.
Trying again in 4.00 seconds...app

 

检查了好久,终于发现是celery配置的broker的url写错了,url

rabbitmqctl add_user sunlight sunlight123spa

rabbitmqctl add_vhost /celeryrabbitmq

rabbitmqctl set_permissions -p /celery sunlight   ".*"   ".*"   ".*" it

app = Celery(__name__, broker="amqp://sunlight:sunlight123@localhost:5672/celery", backend="redis://localhost")io

上门的标红处,显然是错误的,应该替换为以下:配置

app = Celery(__name__, broker="amqp://sunlight:sunlight123@localhost:5672//celery", backend="redis://localhost")celery

便可解决问题。di

相关文章
相关标签/搜索