套接字文件“ /var/pgsql_socket/.s.PGSQL.5432”在Mountain Lion中丢失(OS X Server) [英] Socket File "/var/pgsql_socket/.s.PGSQL.5432" Missing In Mountain Lion (OS X Server)

查看:86
本文介绍了套接字文件“ /var/pgsql_socket/.s.PGSQL.5432”在Mountain Lion中丢失(OS X Server)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用OS X Server将MacMini Server从Lion Server升级到Mountain Lion。我在PostgreSQL上遇到了与去年第一次安装Lion Server时相同的问题。

I just upgraded my MacMini Server from Lion Server to Mountain Lion using OS X Server. I am having the same problem with PostgreSQL that I did last year when I first installed Lion Server.

当我尝试执行任何类型的PostgreSQL终端命令时,我得到以下信息多年来,许多人都臭名昭著的错误消息:

When I try to do any kind of PostgreSQL terminal command I get the following notorious error message that many have gotten over the years:

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

出现错误时,我试图更改_postgres的密码。我尝试了几个命令,但是得到了相同的错误。我只是重新启动了服务器,但是没有运气。我以root用户身份登录以查看/ var / pgsql_socket,并且该文件夹为空。文件夹/ var / pgsql_socket_alt也为空。

I was attempting to change the password for _postgres when I got the error. I tried several commands but got the same error. I just rebooted my server but no luck. I logged in as root to look at /var/pgsql_socket and the folder is empty. Folder /var/pgsql_socket_alt is also empty.

我已经在线检查了这一点。但是,我阅读的几乎所有解决方案(包括Stack Overflow上)都建议删除并重新安装PostgreSQL。我不知道,但这似乎不是一个可行的选择,因为Server App上的几个选项都使用PostgreSQL。我联系了Apple Enterprise支持部门(没有协议),并被告知开发人员必须解决我的问题,该问题将投入695美元。

I have checked online about this. However just about all of the solutions I have read, including on Stack Overflow, suggest a removal and reinstall of PostgreSQL. I do not know but this does not seem like a plausible option because several options on the Server App use PostgreSQL. I contacted Apple Enterprise Support (no agreement) and I was told that my issue would have to be solved by the developers which would cast $695.

我有一个网站现在下来,因为我无法重建它。目前,我不知道该向哪里寻求帮助。我将继续在线寻找是否可以找到一些东西。但是,我希望有人能快速给我一个答案,以便我重建数据库。

I have a website that is down right now because I cannot rebuild it. I don't know where to turn for help with this at this point. I will continue looking online to see if I can find something. However I hope that someone can give me an answer quick so I can rebuild my database.

更新:12/13/2012 15:33 GMT-6

这是ps auwwx | grep postg的输出:

Here is my output for ps auwwx|grep postg:

_postgres      28123   0.0  0.1  2479696   7724   ??  Ss    3:01PM   0:00.04 /Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real -D /Library/Server/PostgreSQL For Server Services/Data -c listen_addresses= -c log_connections=on -c log_directory=/Library/Logs/PostgreSQL -c log_filename=PostgreSQL_Server_Services.log -c log_line_prefix=%t  -c log_lock_waits=on -c log_statement=ddl -c logging_collector=on -c unix_socket_directory=/Library/Server/PostgreSQL For Server Services/Socket -c unix_socket_group=_postgres -c unix_socket_permissions=0770
server1        28216   0.0  0.0  2432768    620 s000  R+    3:02PM   0:00.00 grep postg
_postgres      28138   0.0  0.0  2439388    752   ??  Ss    3:01PM   0:00.01 postgres: stats collector process                           
_postgres      28137   0.0  0.0  2479828   1968   ??  Ss    3:01PM   0:00.00 postgres: autovacuum launcher process                           
_postgres      28136   0.0  0.0  2479696    544   ??  Ss    3:01PM   0:00.00 postgres: wal writer process                           
_postgres      28135   0.0  0.0  2479696    732   ??  Ss    3:01PM   0:00.01 postgres: writer process                           
_postgres      28134   0.0  0.0  2479696    592   ??  Ss    3:01PM   0:00.00 postgres: checkpointer process                           
_postgres      28131   0.0  0.0  2439388    368   ??  Ss    3:01PM   0:00.00 postgres: logger process 

更新:2012年12月13日18:10 GMT-6

经过密集的网络搜索后,发现该视频。我能够使PostgreSQL运行并删除错误。我可以使用pgadmin和phppgadmin进行连接。由于无奈,我正要回到Lion Server。现在,我不必这样做。

After intense web searching this video was found. I was able to get PostgreSQL working and remove the error. I am able to connect using pgadmin and phppgadmin. I was about to go back to Lion Server because of sheer frustration. Now I will not have to.

http ://www.youtube.com/watch?v = y1c7WFMMkZ4

推荐答案

我能够添加以下内容到我的.bash_profile来防止错误:

I was able to add the following to my .bash_profile to prevent the error:

export PGHOST=localhost

这有效因为


如果省略主机名,则psql将通过Unix域套接字连接到服务器上的服务器。本地主机,或者通过TCP / IP到没有Unix域套接字的计算机上的localhost。

If you omit the host name, psql will connect via a Unix-domain socket to a server on the local host, or via TCP/IP to localhost on machines that don't have Unix-domain sockets.

您的操作系统支持Unix域套接字,但是 psql 所需的PostgreSQL Unix套接字不存在,或者位于与期望位置不同的位置。

Your OS supports Unix domain sockets, but PostgreSQL's Unix socket that psql needs either doesn't exist or is in a different location than it expects.

将主机名明确指定为 localhost 强制 psql 使用TCP / I P.设置环境变量 PGHOST 是实现此目的的方法之一。它记录在 psql的手册中。

Specifying a hostname explicitly as localhost forces psql to use TCP/IP. Setting an environment variable PGHOST is one of the ways to achieve that. It's documented in psql's manual.

这篇关于套接字文件“ /var/pgsql_socket/.s.PGSQL.5432”在Mountain Lion中丢失(OS X Server)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆