Redoku在Heroku上拒绝连接 [英] Connection refused for Redis on Heroku

查看:166
本文介绍了Redoku在Heroku上拒绝连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Heroku上设置Redis作为Celery的后端。我有本地工作,但在Heroku,我得到这个错误(芹菜任务完成后):ConnectionError:错误111连接本地主机:6379。连接被拒绝。



从其他答案中我可以看出,这表明redis服务器不在线,尽管REDISTOGO_URL似乎配置正确。 p>

在settings.py中:

  REDIS_URL = os.getenv('REDISTOGO_URL ','redis:// localhost:6379/0')

在tasks.py中:

  from celery import Celery 
celery = Celery('tasks',backend = settings.CELERY_RESULT_BACKEND,broker = settings.REDIS_URL)

版本:

  celery == 3.0.5 
celery-with-redis == 3.0
django-celery == 3.0.4
kombu == 2.3.2
redis == 2.6.0


解决方案

发现问题。我将芹菜后端配置为字符串'redis'而不是REDIS_URL。



我有:

  CELERY_RESULT_BACKEND ='redis'

应该是什么:

  CELERY_RESULT_BACKEND = REDIS_URL 

德米特里 - 感谢您的帮助。

I'm trying to set up Redis on Heroku as a backend for Celery. I have it working locally but on Heroku, I get this error (after the celery task completes): ConnectionError: Error 111 connecting localhost:6379. Connection refused.

From what I can tell from other answers, that would indicate that the redis server isn't online, though the REDISTOGO_URL seems to be configured properly.

In settings.py:

REDIS_URL = os.getenv('REDISTOGO_URL', 'redis://localhost:6379/0')

In tasks.py:

from celery import Celery
celery = Celery('tasks', backend=settings.CELERY_RESULT_BACKEND, broker=settings.REDIS_URL)

Versions:

celery==3.0.5
celery-with-redis==3.0
django-celery==3.0.4
kombu==2.3.2
redis==2.6.0

解决方案

Found the problem. I had the celery backend configured to the string 'redis' rather than the REDIS_URL.

What I had:

CELERY_RESULT_BACKEND = 'redis'

What it should be:

CELERY_RESULT_BACKEND = REDIS_URL

Dmitry - appreciate your help.

这篇关于Redoku在Heroku上拒绝连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆