无法在 linux 上杀死 redis 服务器

cannot kill redis-server on linux

无论我做什么,我似乎都无法在没有立即弹出另一个具有不同 PID 的实例的情况下终止 redis -- 我检查以确保我正在终止父进程,而我确实是。有什么建议么??我已经尝试重新启动我的机器。我也试过 this SO post 的答案。这是我 运行 杀死并检查的命令:

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

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