Python – How to fix ‘Error 111 connecting to localhost:6379’ when starting rq-worker Connection refused’?

How to fix ‘Error 111 connecting to localhost:6379’ when starting rq-worker Connection refused’?… here is a solution to the problem.

How to fix ‘Error 111 connecting to localhost:6379’ when starting rq-worker Connection refused’?

I use flask, redis, and rq-worker in a web application hosted on a Debian 9 machine. When I start rq-worker, I get this error: “Error 111 Connect to localhost: 6379. Connection refused”.

I’ve checked if Redis is installed and running, I tried the commands :

/opt/apps/mywebapp/flask$ ps aux | grep redis
sib       4987  0.0  0.0  12784   976 pts/2    S+   09:37   0:00 grep redis
redis     6574  0.1  0.0  40860  3512 ?        Ssl  may28   3:38 /usr/bin/redis-server 127.0.0.1:6379
/opt/apps/mywebapp/flask$ redis-cli ping
PONG

I’ve read other posts and here’s evidence that Redis is running and running.

I also checked the file redis.conf and set this variable :

bind 127.0.0.1

I tried again.

/opt/apps/mywebapp/flask$ rq worker

But I keep getting the error.

Error 111 connecting to localhost:6379. Connection refused.

Solution

Sorry, it’s the bin property of redis, I set 127.0.0.1::

00, but the correct configuration is 127.0.0.1::01.

Related Problems and Solutions