[英]How to shut down Postgres 9.6.11 without pg_ctl on MacOS?
I have multiple installations of Postgres on my MacOS Mojave machine. 我在MacOS Mojave机器上安装了多个Postgres。 Version 10.7 is running, and I want to shut it down, in order to start 9.6.
版本10.7正在运行,我想关闭它,以便启动9.6。
It's definitely running: 它肯定在运行:
$ psql -h localhost -U postgres
Password for user postgres:
psql (9.6.11, server 10.7)
But I can't stop it: 但我不能阻止它:
/Library/PostgreSQL/10 $ bin/pg_ctl stop
pg_ctl: PID file "/usr/local/var/postgresql@9.6/postmaster.pid" does not exist
Is server running?
Nor with the 9.6 version of pg_ctl: 也不是9.6版本的pg_ctl:
$ pg_ctl stop
pg_ctl: PID file "/usr/local/var/postgresql@9.6/postmaster.pid" does not exist
Is server running?
$ which pg_ctl
/usr/local/opt/postgresql@9.6/bin/pg_ctl
How can I shut down the server, when pg_ctl doesn't seem to be able to control it? 当pg_ctl似乎无法控制它时,如何关闭服务器? I don't recall starting it - perhaps it automatically started when the machine last rebooted.
我不记得启动它 - 也许它在机器上次重启时自动启动。 I think I installed it with Homebrew but I'm not certain.
我想我用Homebrew安装它但我不确定。
This ended up working: 最终工作:
First, get the pid: 首先,得到pid:
$ sudo lsof -i:5432
Password:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 73 postgres 4u IPv6 0x8880707cadb2d1ab 0t0 TCP *:postgresql (LISTEN)
postgres 73 postgres 5u IPv4 0x8880707cadac18ab 0t0 TCP *:postgresql (LISTEN)
Now shut it down (SIGTERM): 现在关闭它(SIGTERM):
$ sudo kill -15 73
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.