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.
Ask the server to close the connection. The connection is closed as soon as all pending replies have been written to the client.
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.
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.
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
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With