ruby-on-rails - OSX 10.8升级后postgres无法连接服务器

标签 ruby-on-rails postgresql osx-mountain-lion homebrew

在最近升级到 Mountain Lion 之后,我在安装 brewed 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"?

很乐意提供任何可能有用的附加信息。

最佳答案

尝试删除:

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

这曾经对我有用。

关于ruby-on-rails - OSX 10.8升级后postgres无法连接服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13755965/

相关文章:

ruby-on-rails - rails : How to implement counter caching with self-referential Many to Many via has_many :through

postgresql - 在 postgres 中建立表之间关系的最佳方法

sql - Postgresql to_char 大大减慢了查询速度

login - 如何通过代码将登录项添加到山狮 osx

javascript - Rails 如何加载 model_name.js?

ruby-on-rails - 如何过滤掉数组中的空元素

python - 如何在 OS X Mountain Lion 上构建 PIL?

macos - launchd:WatchPaths 不会触发简单的 "hello world"脚本 (OS X 10.8)

ruby-on-rails - 如何轻松地将生产 postgresql 数据库克隆到暂存区

sql - 将 array_agg 输出转换为数组而不是字符串