Error 111 connecting to localhost:6379. Connection refused. Django Heroku

后端 未结 12 1049
感动是毒
感动是毒 2020-12-28 12:33

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         


        
相关标签:
12条回答
  • 2020-12-28 13:06

    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

    0 讨论(0)
  • 2020-12-28 13:06

    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!

    0 讨论(0)
  • 2020-12-28 13:07

    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:

    • sudo apt-get upgrade
    • And then restart your ubuntu.

    try to run the container again

    0 讨论(0)
  • 2020-12-28 13:11

    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

    0 讨论(0)
  • 2020-12-28 13:11

    for me, I noticed that the port number was wrong, so I simply fixed it.

        app = Celery("tasks", broker="redis://localhost:6379")
    
    0 讨论(0)
  • 2020-12-28 13:12

    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

    0 讨论(0)
提交回复
热议问题