[英]PostgreSQL server wouldn't shutdown on Lion (Mac OS 10.7)
I installed PostgreSQL using Homebrew on Lion. 我在Lion上使用Homebrew安装了PostgreSQL。 It starts okay but wouldn't shutdown.
它开始没问题,但不会关机。 I tried:
我试过了:
$ #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
launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
rm ~/Library/LaunchAgents/org.postgresql.postgres.plist
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. 使用
-m immediate
关闭PostgreSQL服务器是一种危险的方法,因为“立即”模式将在没有干净关闭的情况下中止所有服务器进程。
This will lead to a recovery run on restart. 这将导致重启时恢复运行。 Try to shutdown PostgreSQL with parameter
-m fast
instead. 尝试使用参数
-m fast
关闭PostgreSQL。 "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 “快速”模式不会等待客户端断开连接,并将终止正在进行的在线备份。所有活动事务都将回滚,客户端将被强制断开连接
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
This works for me 这适合我
pg_ctl -D /Library/PostgreSQL/9.2/data/ start
pg_ctl -D /Library/PostgreSQL/9.2/data/ stop
Source https://sites.google.com/site/amaosblog/database/postgresql/how-to-start-stop-postgresql-9-2-on-mac-os-x-10-8-x 来源https://sites.google.com/site/amaosblog/database/postgresql/how-to-start-stop-postgresql-9-2-on-mac-os-x-10-8-x
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.