升级到OSX 10.8后,Postgres无法连接到服务器。

3

最近升级到Mountain Lion后,我的brew安装的postgres出了问题。

$ rake db:create
>rake db:migratecould not connect to server: Connection refused
>   Is the server running on host "localhost" (::1) and accepting
>   TCP/IP connections on port 5432?
>could not connect to server: Connection refused
>   Is the server running on host "localhost" (fe80::1) and accepting
>   TCP/IP connections on port 5432?
>could not connect to server: Connection refused
>   Is the server running on host "localhost" (127.0.0.1) and accepting
>   TCP/IP connections on port 5432?

在网上搜索了很久,我还没有找到解决这个问题的方法。

我发现了一些建议的步骤来帮助识别问题,但在按照这些步骤后,我不确定如何理解结果或下一步该做什么。有人能帮忙吗?

$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
>pg_ctl: another server might be running; trying to start server anyway
>server starting


$ pg_ctl -D /usr/local/var/postgres stop -s -m fast
>pg_ctl: could not send stop signal (PID: 865): No such process


$ pg_ctl status                                                                
>pg_ctl: no server running


$ ps auxw | grep post 
>myuser   19037   2.6  7.7  4388248 324520   ??  S     7:30AM  19:06.02 /Applications/Postbox.app/Contents/MacOS/postbox-bin -psn_0_917728
>myuser   54897   0.1  0.0  2432768    464 s000  R+    1:47PM   0:00.01 grep post


$ cat /usr/local/var/postgres/server.log
>FATAL:  lock file "postmaster.pid" already exists
>HINT:  Is another postmaster (PID 821) running in data directory "/usr/local/var/postgres"?

很高兴为您提供任何可能有用的额外信息。


也许这个会有帮助:https://gist.github.com/1877457 让我知道。 - Dillon Benson
好的,这可能很有前途。kill 命令返回了失败:没有这个进程。stop 命令也返回了无法发送停止信号(PID: xxx):没有这个进程。最后一个选项出现了致命错误:数据目录“/usr/local/var/postgres”的所有权不正确,我怀疑这可能很重要,但我不确定它应该如何运作。感谢任何建议。 - Andy Harvey
1个回答

2

尝试移除:

/usr/local/var/postgres/postmaster.pid

这曾经对我有用过。

谢谢Dillon,我已经尝试过了,但是没有成功 :) 你能否详细解释一下你的步骤?例如,停止数据库,删除,重新启动...? - Andy Harvey

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接