Redis won't shutdown

Solution 1:

Do you have Redis listening on an interface other than localhost or 127.0.0.1? If so, the stop command is never being sent to the right interface, as the official Redis init template fails to include the host address.

In the /etc/init.d/redis files I’ve worked with, I had to define REDISHOST=10.150.0.18 and then on line 30 (look for “shutdown”) add that host argument:

$CLIEXEC -h $REDISHOST -p $REDISPORT shutdown

Solution 2:

If you were like me, you required a password (requirepass) in your redis.conf. the redis-cli command won't respond without the password now.

In the first few lines of your /etc/init.d/redis file look for CLIEXEC and change the default

CLIEXEC=/usr/local/bin/redis-cli

to

CLIEXEC="/usr/local/bin/redis-cli -a <password>"

Please take note of the quotes.

When I did this I didn't have to include the -h $REDISHOST parameters.

See here for the source of the idea: https://groups.google.com/forum/#!topic/redis-db/ITtbA1S-GGg

Solution 3:

The conversation in this list can solve your problem:

Modify your init script to use '-a' (auth) in the redis-cli call.

CLIEXEC="/usr/local/bin/redis-cli -a password"

In other words, the problem is the fact that you have to enter the Redis password to stop the service. Modifying the /etc/init.d/redis_port script (or any other init script you might have) with -a password will solve it.