postgresql 无法杀死 Postgres 进程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44607421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot kill Postgres process
提问by flaurida
I keep trying to kill a PostgreSQL process that is running on port 5432 to no avail. Whenever I type sudo lsof -i :5432
, I see something like the below:
我一直试图杀死在端口 5432 上运行的 PostgreSQL 进程,但无济于事。每当我输入时sudo lsof -i :5432
,我都会看到如下所示的内容:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 587 postgres 4u IPv6 0x218f97e9af5d0303 0t0 TCP *:postgresql (LISTEN)
postgres 587 postgres 5u IPv4 0x218f97e9ae0f6c63 0t0 TCP *:postgresql (LISTEN)
I then try to kill the process 587 in this example with sudo kill -9 587
, but then another process automatically restarts on the same port! I have tried killing it on activity monitor as well to no avail. Please help?
然后,我尝试使用 杀死本示例中的进程 587 sudo kill -9 587
,但是另一个进程会在同一端口上自动重新启动!我也尝试在活动监视器上杀死它,但无济于事。请帮忙?
Thanks, Laura
谢谢,劳拉
回答by Moebius
If you installed postgres using brew, this command might be what you are looking for :
如果您使用 brew 安装了 postgres,则此命令可能就是您要查找的命令:
brew services stop postgres
回答by Stanislav Kr.
I have 9.5 and 9.6 installed, so
我安装了 9.5 和 9.6,所以
sudo su - postgres
/Library/PostgreSQL/9.6/bin/pg_ctl -D /Library/PostgreSQL/9.6/data stop
须藤 su - postgres
/Library/PostgreSQL/9.6/bin/pg_ctl -D /Library/PostgreSQL/9.6/data stop
9.5 started ...
9.5开始...
/Library/PostgreSQL/9.5/bin/pg_ctl -D /Library/PostgreSQL/9.5/data stop
/Library/PostgreSQL/9.5/bin/pg_ctl -D /Library/PostgreSQL/9.5/data stop
回答by Steven Shi
list your postgres pid:
列出你的 postgres pid:
pg_ctl status -D /usr/local/var/postgres
pg_ctl: server is running (PID: 715)
force kill it..
强行杀..
kill -9 715
回答by Daniel
回答by l'L'l
The process is restarting likely because it's spawned from a launchd
daemon. You can try finding it and killing it through the launchctl
command:
该进程可能正在重新启动,因为它是从launchd
守护进程产生的。您可以尝试通过以下launchctl
命令找到它并杀死它:
$ launchctl list
To kill a process you would:
要终止进程,您将:
$ launchctl kill