redis停止
停止redis服务有两种办法
1、利用kill命令强制停止
2、使用命令进行停止:./redis-cli shutdown
利用kill命令强制停止
[root@pratice bin]# pwd
/usr/local/redis/bin
[root@pratice bin]# ps -aux|grep redis
root 1781 0.0 0.0 10812 1016 pts/1 S+ 21:09 0:00 ./redis-cli
root 1946 0.1 0.0 35560 1720 ? Ssl 21:30 0:00 ./redis-server *:6379
root 1970 0.0 0.0 5980 728 pts/0 S+ 21:35 0:00 grep redis
[root@pratice bin]# kill 1946
使用命令进行停止
[root@pratice bin]# ./redis-cli shutdown
[root@pratice bin]# ps -aux|grep redis
root 1781 0.0 0.0 10812 1016 pts/1 S+ 21:09 0:00 ./redis-cli
root 1979 0.0 0.0 5980 728 pts/0 S+ 21:38 0:00 grep redis
[root@pratice bin]#
使用命令执行完成后,查看进程,发现redis服务已经停止
强行终止Redis进程可能会导致redis持久化数据丢失。正确停止Redis的方式应该是向Redis发送SHUTDOWN命令