Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start and stop redis service with authentication?

Tags:

redis

I've set a password for my Redis server and when I try to restart the Redis server with sudo service redis_6379 restart then I get the following error message:

NOAUTH Authentication required.

How can I pass my password through the restart command?

The Redis version is 3.0.3.

like image 956
Murdoch Avatar asked Aug 23 '15 09:08

Murdoch


People also ask

How do I start Redis services?

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.

How do I exit Redis?

If you started the Redis server using the redis-server command, you could stop the Redis server by pressing CTRL + C.


2 Answers

You could modify your init.d/redis_6379 script and use the -a parameter of redis-cli to specify the password:

CLIEXEC="/usr/local/bin/redis-cli -a your_secret"
like image 69
Darin Dimitrov Avatar answered Oct 23 '22 04:10

Darin Dimitrov


redis-cli connect to your server and authenticate yourself.

  1. $ redis-cli -a serverpassword
  2. $ shutdown
  3. $ quit
like image 33
simplytunde Avatar answered Oct 23 '22 05:10

simplytunde