在Mac OS X 10.8.4上有一个postgresql的问题。我不小心做brew rm postgresql –force,而postgres服务器正在运行。当我安装使用“brew install postgresql”并运行“pg_ctl -D /usr/local/var / postgres start”我得到:
pg_ctl: another server might be running; trying to start server anyway server starting FATAL: lock file "postmaster.pid" already exists HINT: Is another postmaster (PID 752) running in data directory "/usr/local/var/postgres"?
当我运行“ps -ef | grep postgres”我得到:
501 752 235 0 12:42PM ?? 0:00.01 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log 501 754 752 0 12:42PM ?? 0:00.00 postgres: checkpointer process 501 755 752 0 12:42PM ?? 0:00.34 postgres: writer process 501 756 752 0 12:42PM ?? 0:00.02 postgres: wal writer process 501 757 752 0 12:42PM ?? 0:00.01 postgres: autovacuum launcher process 501 758 752 0 12:42PM ?? 0:00.01 postgres: stats collector process 501 945 452 0 12:58PM ttys000 0:00.00 grep postgres
当我试图停止服务器与“pg_ctl stop -D /usr/local/var / postgres -m fast”或“pg_ctl -D /usr/local/var / postgres stop -mi”我得到:
waiting for server to shut down........................................... Failed pg_ctl: server does not shut down
任何想法stackbros?
编辑
which pg_ctl /usr/local/bin/pg_ctl pg_ctl --version pg_ctl (Postgresql) 9.2.4
server.log的Gist:https://gist.github.com/anonymous/6106182
有同样的问题,pg_ctl:服务器没有关闭。此外,ps auxwww | grep postgres显示没有postgres运行,而pg_ctl -D /usr/local/var / postgres状态显示postgres正在运行。重新启动我的mac没有帮助,我甚至去远程重置SMC,但这个SO Q / A给了我一个想法下一步:brew问题。
原文链接:https://www.f2er.com/postgresql/193564.html遵循这一思路,我发现这有用的blog post,下来到下面的命令解决这个问题为我:
$ brew services list $ brew services restart postgresql
希望这将帮助别人。
更新 – 未知命令:服务
经过一番调查后,一个意见(‘未知的命令:服务’),我发现,Homebrew的作者决定删除服务从仓库,看到没有人想要维护这个代码。
你可以阅读更多关于它here和here(相关github的门票)。
经过一些更多的挖掘,我发现this repo,增加了在macs的服务。
这是我’返回’服务:
~ » brew tap gapple/services ~ » brew services usage: [sudo] brew services [--help] <command> [<formula>] Small wrapper around `launchctl` for supported formulae,commands available: cleanup Get rid of stale services and unused plists list List all services managed by `brew services` restart Gracefully restart selected service start Start selected service stop Stop selected service Options,sudo and paths: sudo When run as root,operates on /Library/LaunchDaemons (run at boot!) Run at boot: /Library/LaunchDaemons Run at login: /Users/user/Library/LaunchAgents
这里是另一个建议的解决方案:http://apple.stackexchange.com/questions/150300/need-help-using-homebrew-services-command.没有检查它自己,所以不知道如何和如何它的工作原理。