PostgreSQL 服务器不会在 Lion (Mac OS 10.7) 上关闭

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6950395/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 23:03:31  来源:igfitidea点击:

PostgreSQL server wouldn't shutdown on Lion (Mac OS 10.7)

macospostgresqlosx-lion

提问by Greg

I installed PostgreSQL using Homebrew on Lion. It starts okay but wouldn't shutdown. I tried:

我在 Lion 上使用 Homebrew 安装了 PostgreSQL。启动正常,但不能关机。我试过:

$ #started with
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
$ #tried stoping with
$ pg_ctl -D /usr/local/var/postgres stop -m immediate
waiting for server to shut down................................... failed
pg_ctl: server does not shut down


I fixed this issue by deleting the Launch Agent:

我通过删除启动代理解决了这个问题:

launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
rm ~/Library/LaunchAgents/org.postgresql.postgres.plist

回答by Greg

launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
rm ~/Library/LaunchAgents/org.postgresql.postgres.plist

回答by francs

Shutting down PostgreSQL Server with -m immediateis a dangerous way to do it, because “Immediate” mode will abort all server processes without a clean shutdown.

关闭 PostgreSQL 服务器-m immediate是一种危险的方式,因为“立即”模式将在没有干净关闭的情况下中止所有服务器进程。

This will lead to a recovery run on restart. Try to shutdown PostgreSQL with parameter -m fastinstead. "Fast” mode does not wait for clients to disconnect and will terminate an online backup in progress. All active transactions are rolled back and clients are forcibly disconnected

这将导致在重新启动时运行恢复。尝试使用参数关闭 PostgreSQL -m fast。“快速”模式不等待客户端断开连接,将终止正在进行的在线备份。所有活动事务都回滚并强制断开客户端连接

pg_ctl stop -D /usr/local/var/postgres -m fast 

For more information about pg_ctl please visit http://www.postgresql.org/docs/9.0/static/app-pg-ctl.html

有关 pg_ctl 的更多信息,请访问 http://www.postgresql.org/docs/9.0/static/app-pg-ctl.html

回答by SathishVenkat

回答by Obromios

If you used Homebrew to install postgresql, then as Shevauns comment on Greg's answer indicates, the correct procedure is

如果您使用 Homebrew 安装 postgresql,那么正如 Shevauns 对 Greg 回答的评论所示,正确的程序是

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist