Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I stop redis-server?

I apparently have a redis-server instance running because when I try to start a new server by entering redis-server, I'm greeted with the following:

Opening port: bind: Address already in use 

I can't figure out how to stop this server and start a new one.

Is there any command I can append to redis-server when I'm typing in the CLI?

My OS is Ubuntu 10.04.

like image 791
Qcom Avatar asked Aug 02 '11 10:08

Qcom


People also ask

How do I quit a Redis server?

Ask the server to close the connection. The connection is closed as soon as all pending replies have been written to the client.

How do I stop Redis clustering?

You can gracefully shutdown Redis instances (sentinel, slave and master) with the shutdown command. For Redis version older than 3.0 (not very sure), there's no shutdown command for Redis sentinel. But you can just use killall or kill -9 process_id to kill it without any side effect.

How do I know if Redis server is running?

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.


2 Answers

Either connect to node instance and use shutdown command or if you are on ubuntu you can try to restart redis server through init.d:

/etc/init.d/redis-server restart 

or stop/start it:

/etc/init.d/redis-server stop /etc/init.d/redis-server start 

On Mac

redis-cli shutdown 
like image 71
yojimbo87 Avatar answered Oct 12 '22 23:10

yojimbo87


A cleaner, more reliable way is to go into redis-cli and then type shutdown

In redis-cli, type help @server and you will see this near the bottom of the list:

SHUTDOWN - summary: Synchronously save the dataset to disk and then shut down the server since: 0.07

And if you have a redis-server instance running in a terminal, you'll see this:

User requested shutdown... [6716] 02 Aug 15:48:44 * Saving the final RDB snapshot before exiting. [6716] 02 Aug 15:48:44 * DB saved on disk [6716] 02 Aug 15:48:44 # Redis is now ready to exit, bye bye... 
like image 23
Kevin McTigue Avatar answered Oct 12 '22 21:10

Kevin McTigue