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