无法杀死Linux上的redis服务器

问题描述:

无论我做什么,如果没有另一个实例立即弹出并带有另一个PID的话,我似乎都无法杀死Redis -我检查以确保自己正在杀死父进程.有什么建议??我已经尝试过重新启动机器.我还尝试了这篇SO帖子中的答案.这是我运行的要杀死并检查的命令:

No matter what I do I can't seem to kill redis without another instance popping up immediately with a different PID -- I checked to make sure I was killing the parent process and I was. Any suggestions?? I've already tried restarting my machine. I've also tried the answers from this SO post. Here are the commands I ran to kill and check:

ascourtas@ascourtas-VirtualBox:~$ ps -ef | grep redis
redis     2573     1  0 12:11 ?        00:00:00 /usr/bin/redis-server 
0.0.0.0:6379
ascourt+  2991  2501  0 12:25 pts/6    00:00:00 grep --color=auto 
redis

ascourtas@ascourtas-VirtualBox:~$ pgrep redis | xargs -i pstree -ps 
{}
systemd(1)───redis-server(2573)─┬─{redis-server}(2575)
                            └─{redis-server}(2576)

ascourtas@ascourtas-VirtualBox:~$ sudo kill -9 2573

ascourtas@ascourtas-VirtualBox:~$ ps -ef | grep redis
redis     3069     1  0 12:26 ?        00:00:00 /usr/bin/redis-server 
0.0.0.0:6379
ascourt+  3077  2501  0 12:26 pts/6    00:00:00 grep --color=auto 
redis

想通了!当我尝试了此SO帖子中提供的第二个答案时,我当我实际上应该运行/etc/init.d/redis-server stop时,已经完成了cd /etc/init.d然后又运行了redis-server stop.我不知道为什么这很重要.

Figured it out! Turns out when I had tried the second answer provided at this SO post, I had done cd /etc/init.d and then ran redis-server stop, when I actually should've run /etc/init.d/redis-server stop. I do not know why this matters though.