Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shutdown redis-server from command line

I am trying to shutdown my redis-server from a redis-cli. Whenever I issue a command from a client I receive the error "(error) NOAUTH Authentication required." I have tried the commands "SHUTDOWN" and "SHUTDOWN NOSAVE".

I have also tried "redis-server stop" from another terminal window but received the error "# Fatal error, can't open config file 'stop'"

How can I shut down this server? (I am on OSX).

like image 281
trvslhlt Avatar asked Apr 30 '14 19:04

trvslhlt


3 Answers

Your Redis server is configured with a password apparently. Therefore, when using redis-cli, you'll need to issue the AUTH password command before any other command or else you'll be getting that error message (replace password with your server's password).

Alternatively, you can invoke redis-cli with the -a switch followed by your password for the same result.

To find the password of your server, open the Redis configuration file (by default /etc/redis/6379.conf) and look for the line starting with requirepass - whatever value is next to it, is the password.

like image 181
Itamar Haber Avatar answered Oct 22 '22 18:10

Itamar Haber


1. redis-cli
2. auth yourpassword
3. shutdown
4. sudo service redis_6379 start
like image 40
Farid Movsumov Avatar answered Oct 22 '22 16:10

Farid Movsumov


You have to manually edit the start/stop-service script:

sudo vi /etc/init.d/redis_6379

Find the following line:

$CLIEXEC -p $REDISPORT shutdown

And replace it with the following 'changeit' is where your password goes:

$CLIEXEC -p $REDISPORT -a changeit shutdown

Now you should be able to start and stop the service without any problems.

like image 31
aksamit Avatar answered Oct 22 '22 17:10

aksamit