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.
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...
redis-cli shutdown
is most effective. The accepted answer does not work for me (OSX Lion). Thanks, @JesseBuesking.
For OSX, I created the following aliases for starting and stopping redis
(installed with Homebrew):
alias redstart='redis-server /usr/local/etc/redis/6379.conf'
alias redstop='redis-cli -h 127.0.0.1 -p 6379 shutdown'
This has worked great for local development!
Homebrew now has homebrew-services
that can be used to start, stop and restart services. homebrew-services
brew services
is automatically installed when run.
brew services start|run redis
brew services stop redis
brew services restart redis
If you use run
, then it will not start it at login (nor boot). start
will start the redis
service and add it at login and boot.