5

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).

trvslhlt
  • 65
  • 1
  • 2
  • 6

4 Answers4

10

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.

Itamar Haber
  • 47,336
  • 7
  • 91
  • 117
  • Thank you for the response. I ended up killing the redis-server process from the activity manager. I am going recreate the behavior I was seeing earlier and try out your more civilized way of handling to problem. – trvslhlt Apr 30 '14 at 23:22
  • my /etc/redis/6379.conf is empty so how do I find the password now? – Suresh Feb 08 '22 at 12:31
  • You'll need to find which conf file your server uses - by default, Redis is not protected by a password. – Itamar Haber Feb 09 '22 at 15:04
9
1. redis-cli
2. auth yourpassword
3. shutdown
4. sudo service redis_6379 start
Farid Movsumov
  • 12,350
  • 8
  • 71
  • 97
7

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.

aksamit
  • 2,325
  • 8
  • 28
  • 40
0

On Amazon EC2 instance I could restart local Redis like this:

sudo /etc/init.d/redis restart

P.S. If you are using Redis Authentication you have to pass -a <pass> parameter.

D.Dimitrioglo
  • 3,413
  • 2
  • 21
  • 41