How can I stop redis-server?

2019-01-15 23:49发布

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.

21条回答
做自己的国王
2楼-- · 2019-01-16 00:18

Type SHUTDOWN in the CLI

or

if your don't care about your data in memory, you may also type SHUTDOWN NOSAVE to force shutdown the server.

查看更多
smile是对你的礼貌
3楼-- · 2019-01-16 00:19

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
查看更多
啃猪蹄的小仙女
4楼-- · 2019-01-16 00:21

Try killall redis-server. You may also use ps aux to find the name and pid of your server, and then kill it with kill -9 here_pid_number.

查看更多
在下西门庆
5楼-- · 2019-01-16 00:21

If you are running redis in a docker container, none of the present answers will help. You have to stop redis container. Otherwise, redis process will keep respawning.

$ docker ps
CONTAINER ID        IMAGE                    PORTS                             
e1c008ab04a2        bitnami/redis:4.0.8-r0   0.0.0.0:6379->6379/tcp

$ docker stop e1c008ab04a2
e1c008ab04a2
查看更多
ら.Afraid
6楼-- · 2019-01-16 00:23

redis-cli shutdown is most effective. The accepted answer does not work for me (OSX Lion). Thanks, @JesseBuesking.

查看更多
戒情不戒烟
7楼-- · 2019-01-16 00:24

stop the redis server type in terminal with root user

sudo service redis-server stop

the message will be display after stop the redis-server

Stopping redis-server: redis-server.

if you want to start the redis-server type

sudo service redis-server start

if you want to restart the server type

sudo service redis-server restart
查看更多
登录 后发表回答