我的本地开发环境出了问题。
我所有的本地Rails应用现在都会显示以下错误:
PGError
could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
我不知道是什么原因导致了这个问题。
在寻找解决方法时,我更新了所有捆绑的gems,更新了系统gems,更新了MacPorts,但都没有成功。
其他人在从OSX Leopard升级到Lion时报告了此问题,这是由于对应该使用哪个版本的Postgres(即OSX版本还是MacPorts版本)感到困惑。我已经运行了几个月的Lion,所以现在发生这种情况似乎很奇怪。
我不愿意在充分理解问题之前过度操作。如何有条不紊地调试它?
如何确定我的系统上有多少个PostgreSQL版本,哪一个正在被访问,以及它的位置在哪里?如果使用了错误的PostgreSQL,该怎么办?
对于这些初学者问题,我很抱歉。我还在学习这个!感谢任何指导。
编辑:
根据下面的建议和评论进行了一些更新。
我尝试运行pg_lsclusters
,但返回了“command not found”错误。
然后我尝试找到我的pg_hba.conf文件,并找到了这三个示例文件:
/opt/local/share/postgresql84/pg_hba.conf.sample
/opt/local/var/macports/software/postgresql84/8.4.7_0/opt/local/share/postgresql84/pg_hba.conf.sample
/usr/share/postgresql/pg_hba.conf.sample
所以我假设安装了三个版本的PSQL?Macports、OSX默认和???。
然后我搜索了一下launchctl启动脚本ps -ef | grep postgres
,返回了以下内容:
0 56 1 0 11:41AM ?? 0:00.02 /opt/local/bin/daemondo --label=postgresql84-server --start-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper restart ; --pid=none
500 372 1 0 11:42AM ?? 0:00.17 /opt/local/lib/postgresql84/bin/postgres -D /opt/local/var/db/postgresql84/defaultdb
500 766 372 0 11:43AM ?? 0:00.37 postgres: writer process
500 767 372 0 11:43AM ?? 0:00.24 postgres: wal writer process
500 768 372 0 11:43AM ?? 0:00.16 postgres: autovacuum launcher process
500 769 372 0 11:43AM ?? 0:00.08 postgres: stats collector process
501 4497 1016 0 12:36PM ttys000 0:00.00 grep postgres
我已经在http://pastebin.com/Gj5TpP62发布了postgresql84-server.wrapper的内容。
我尝试运行port load postgresql184-server
,但收到错误提示:Error: Port postgresql184-server not found
。
我仍然很困惑如何解决这个问题,并感谢任何“白痴式”的指针。
谢谢!
编辑2
这个问题始于我与daemondo有些问题。 我本地的Rails应用程序崩溃并显示应用程序错误,比如“找不到daemondo gem”。然后我进行了一系列的bundle、gem、port和brew更新,以尝试找到问题。
这个错误可能与daemondo有关吗?