Postgresql server will not start after OS X Yosemite upgrade, homebrew

主宰稳场 提交于 2019-12-11 02:54:17

问题


Steps to recreate error:

  • brew uninstall postgresql
  • brew prune
  • brew install postgresql
  • run postgresql start commands
  • psql

yields:

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"?

Suggested fixes I have tried that don't work:

create missing symbolic link:

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

remove postmaster.pid file (same link as above):

  • 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

Edit 1:

This article correctly speculates that there are multiple versions of postgres in use, and which pg_ctl must be specified (below). Strangely, there are two directories in /usr/local/var: postgre & postgres. If anybody knows which settings to update to use the proper pg_ctl command directly, I would appreciate it!

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


回答1:


I ran into the same issue and after looking at the log file I found one directory was missing:

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

Then I did $ mkdir /usr/local/var/postgres/pg_tblspc, restarted PostgreSQL and got:

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

After redoing the process may times I eneded up creating the following directories and then successfully started 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

I hope this helps.



来源:https://stackoverflow.com/questions/27071697/postgresql-server-will-not-start-after-os-x-yosemite-upgrade-homebrew

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!