OS X Yosemite升级后,自制程序将无法启动Postgresql服务器

时间:2014-11-21 22:51:26

标签: postgresql homebrew osx-yosemite

重新创建错误的步骤:

  • brew uninstall postgresql
  • brew prune
  • brew install postgresql
  • 运行postgresql启动命令
  • psql

的产率:

psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

我尝试过的建议修复不起作用

create missing symbolic link:

  • sudo mkdir /var/pgsql_socket/
  • sudo ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/

删除postmaster.pid文件(与上面相同的链接):

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

create potentially "cleaned up" directories from upgrade:

  • mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/ touch /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/.keep

Related GitHub issue

修改1:

This article正确推测有多个版本的postgres正在使用,并且必须指定pg_ctl(下方)。奇怪的是,/usr/local/var中有两个目录:postgre& postgres。如果有人知道要更新哪些设置以直接使用正确的pg_ctl命令,我将不胜感激!

/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_ctl -D /usr/local/var/postgre start

1 个答案:

答案 0 :(得分:4)

我遇到了同样的问题,在查看日志文件后发现一个目录丢失了:

$ tail /usr/local/var/postgres/server.log
FATAL:  could not open directory "pg_tblspc": No such file or directory

然后我做了$ mkdir /usr/local/var/postgres/pg_tblspc,重新启动了PostgreSQL并得到了:

$ tail /usr/local/var/postgres/server.log
FATAL:  could not open directory "pg_replslot": No such file or directory

重做过程后,我可能会创建以下目录,然后成功启动PostgreSQL:

/usr/local/var/postgres/pg_tblspc
/usr/local/var/postgres/pg_replslot
/usr/local/var/postgres/pg_twophase
/usr/local/var/postgres/pg_logical
/usr/local/var/postgres/pg_logical/mappings

我希望这会有所帮助。