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
PostgreSQL server wouldn't shutdown on Lion (Mac OS 10.7)
提问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 immediate
is 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 fast
instead. "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
This works for me
这对我有用
pg_ctl -D /Library/PostgreSQL/9.2/data/ start
pg_ctl -D /Library/PostgreSQL/9.2/data/ stop
回答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