Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rescue : Connection refused - Unable to connect to Redis on localhost:6379

Tags:

redis

resque

I have followed the instructions to install resque, but now when I try to spawn a worker with this command I get a connection error:

$ QUEUE=mailer rake environment resque:work --trace 

this is the error that I get:

Connection refused - Unable to connect to Redis on localhost:6379

like image 788
Steven Avatar asked Jan 12 '11 14:01

Steven


People also ask

Could not connect to Redis at Redis 6379 Connection Refused?

Firewall restriction is another common reason that can trigger the “could not connect to Redis connection refused”. By default Redis server listen to the TCP port 6379. If another application is using the port or if the firewall restrictions blocks the port, it can trigger the connection refused error.

How do I connect to Redis locally?

To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command. In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.

What is Redis default port?

By default, the Redis server runs on TCP Port 6379.


1 Answers

Have you verified redis-server is running? Please don't ask me to dissect the following command, but in a terminal you can type:

ps aux | grep redis

You should then see something like:

redis 13319 0.0 0.0 2884 1056 ? Ss 10:54 0:00 /usr/bin/redis-server /etc/redis/redis.conf

If it's not running, I recommend issuing the following command:

nohup redis-server &

That will start a redis-server process and detach it from the terminal. Otherwise I believe you need to leave that terminal open the entire time you want redis-server to be running.

(Always a good idea to verify the process is running once you fire it up, so use that first command once more.)

Update: I'm not sure if this works for all versions, but on Redis Server 3.0.6 on Ubuntu 16.04, you can issue sudo service redis-server status as well. You'll receive some verbose output, so I'll not post it all, but that may be another option for some of us.

like image 166
Tass Avatar answered Sep 16 '22 14:09

Tass