温馨提示×

linux开启redis服务后如何退出

小新
2488
2021-02-24 18:27:38
栏目: 云计算

linux开启redis服务后如何退出

linux开启redis服务后退出的方法:

1.在终端输入以下命令关闭redis-server即可退出。

redis-cli shutdown

示例:

$ps -ef | grep redis

root 23422 19813 0 10:59 pts/5 00:00:08 redis-server *:6379

$sudo redis-cli shutdown

[23422] 05 Mar 12:11:29.301 # User requested shutdown...

[23422] 05 Mar 12:11:29.301 * Saving the final RDB snapshot before exiting.

[23422] 05 Mar 12:11:29.314 * DB saved on disk

[23422] 05 Mar 12:11:29.314 # Redis is now ready to exit, bye bye...

[1]+ Done sudo redis-server (wd: ~/soft/redis-2.10.3)

(wd now: ~/soft/redis-2.8.17)

$ps -ef | grep redis

jihite 30563 19813 0 12:11 pts/5 00:00:00 grep redis

如果redis有设置密码需要通过以下方式关闭退出。

sudo redis-cli -h host -p port -a passwd shutdown

2.退出客户端。

localhost:6379> QUIT

0