I am able to run redis locally and everything works.
However when I deploy to heroku I get this error:
Error 111 connecting to localhost:6379. Conn
May be not directly related to your question but I was facing same error and it turn out that on my system redis-server package was not installed.
Problem was resolved with,
Ubuntu: sudo apt-get install redis-server
Cent OS: sudo yum install redis
If you are using django_rq, a configuration like this will work for you:
RQ_QUEUES = {
'default': {
'HOST': 'localhost',
'PORT': '6379',
'URL': os.getenv('REDISTOGO_URL', 'redis://localhost:6379'), # If you're
'DB': 0,
'DEFAULT_TIMEOUT': 480,
}
}
It will make that work on your local environment and also on Heroku!
Not sure if it work in all the cases. If this error occurs when using redis in docker, try to do the following,it may help:
try to run the container again
The solution is sudo apt-get install redis-server
.
Don't forget to start your service by sudo service redis-server start
and you can use the command sudo service redis-server {start|stop|restart|force-reload|status}
for reference
for me, I noticed that the port number was wrong, so I simply fixed it.
app = Celery("tasks", broker="redis://localhost:6379")
I also landed here with the following problem.
Trying again in 2.00 seconds...
[2019-06-10 07:25:48,432: ERROR/MainProcess] consumer: Cannot connect to redis://localhost:6379//: Error 111 connecting to localhost:6379. Connection refused..
Trying again in 4.00 seconds...
[2019-06-10 07:25:52,439: ERROR/MainProcess] consumer: Cannot connect to redis://localhost:6379//: Error 111 connecting to localhost:6379. Connection refused..
Trying again in 6.00 seconds...
[2019-06-10 07:25:58,447: ERROR/MainProcess] consumer: Cannot connect to redis://localhost:6379//: Error 111 connecting to localhost:6379. Connection refused..
Trying again in 8.00 seconds...
I realized the problem was the ufw which was denying the connections. Therefore, I allowed connections at this port using the following command.
sudo ufw alloww 6379