我正在尝试杀死以--daemonize yes
开头的redis服务器我觉得这应该很简单,但我无法根据标准方法成功杀死它。我通过以下说明安装了Redis 3.2:https://www.hugeserver.com/kb/install-redis-debian-ubuntu/
$ redis-server --daemonize yes
1550:C 13 Mar 05:54:55.436 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1550:C 13 Mar 05:54:55.437 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=1550, just started
1550:C 13 Mar 05:54:55.437 # Configuration loaded
$ kill 1550
-bash: kill: (1550) - No such process
$ kill -9 1550
-bash: kill: (1550) - No such process
$ killall redis-server
redis-server(1181): Operation not permitted
redis-server: no process found
$ /etc/init.d/redis-server stop
[....] Stopping redis-server (via systemctl): redis-server.service==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to stop 'redis-server.service'.
Authenticating as: Ubuntu (ubuntu)
Password:
为什么我需要输入密码来阻止它?我开始时从不设置密码。为什么不杀人工作呢?即使我sudo它,它只是重新启动后。
------------------- EDIT -------------------
其他信息。对进程ID使用kill命令不起作用。我必须使用sudo kill但是它会返回另一个processid,好像有什么东西重新启动它一样。我刚刚杀了它3次,它又回到了第4个进程 -
----------感谢@Kevin Law ----------
我需要杀死守护进程的服务然后终止进程。不仅仅是其中一个......
ubuntu@ip-MyIPAddress:~/Relayer$ ps -ef | grep redis-server
ubuntu 2381 1 0 18:39 ? 00:00:00 redis-server *:6379
ubuntu 2386 1358 0 18:39 pts/0 00:00:00 grep --color=auto redis-server
ubuntu@ip-MyIPAddress:~/Relayer$ sudo service redis-server stop
ubuntu@ip-MyIPAddress:~/Relayer$ ps -ef | grep redis-server
ubuntu 2381 1 0 18:39 ? 00:00:00 redis-server *:6379
ubuntu 2418 1358 0 18:39 pts/0 00:00:00 grep --color=auto redis-server
ubuntu@ip-MyIPAddress:~/Relayer$ kill 2381
ubuntu@ip-MyIPAddress:~/Relayer$ ps -ef | grep redis-server
ubuntu 2420 1358 0 18:39 pts/0 00:00:00 grep --color=auto redis-server
ubuntu@ip-MyIPAddress:~/Relayer$
答案 0 :(得分:3)
我的测试中有三个选项可供选择。
你试过这个吗?
bash
sudo systemctl stop redis-server
要么
sudo service redis-server stop
连接到此redis-server并通过redis-cli关闭它。
redis-cli
连接到redis后,发出shutdown以关闭redis-server
shutdown
直接杀死redis-server进程:
ps -ef | grep redis-server
kill -9 (pid)
答案 1 :(得分:0)
尝试使用以下命令查找正在运行的redis-server实例,然后尝试使用 kill 命令查找确切的实例。
ps -aef | grep redis