Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shutting down Redis

Tags:

redis

I started up Redis for the first time on my local machine today and then later closed all terminal windows after I shutdown my Rails app. An hour later, I started up the Rails app again and did the following to start the redis server

redis-server /usr/local/etc/redis.conf

However, it told me

# Opening port 6379: bind: Address already in use

I therefore assumed it was still running its earlier instance even though I closed the terminal windows on my Mac.

Looking at this page http://redis.io/commands/shutdown, I tried to run

SHUTDOWN

in the terminal window but I get this response

SHUTDOWN: NOT super-user

I therefore tried (Even though I didn't use sudo to start it)

sudo SHUTDOWN 

and after it asked me for my password, it output this

usage: shutdown [-] [-h [-u] [-n] | -r [-n] | -s | -k] time [warning-message ...]

but when I randomly ran shutdown -s it said

 SHUTDOWN: NOT super-user

What's the proper way to shutdown Redis when I close up my app?

like image 570
BrainLikeADullPencil Avatar asked Apr 22 '13 03:04

BrainLikeADullPencil


1 Answers

Use the built-in redis client: redis-cli shutdown

like image 116
Alan Dixon Avatar answered Oct 04 '22 01:10

Alan Dixon