无法在Mac OS X上重启Postgres

6
我无法在Mac OS X上重新启动postgres服务器。我该怎么解决?
尝试了两种方法:
使用pg_ctl restart命令,返回以下内容:
pg_ctl: PID file "usr/local/var/postgres:/postmaster.pid" does not exist
Is server running?
starting server anyway
pg_ctl: could not read file "usr/local/var/postgres:/postmaster.opts"

服务器没有重新启动

执行pg_ctl -D /usr/local/var/postgres restart的结果是:

   pg_ctl: PID file "/usr/local/var/postgres/postmaster.pid" does not exist
   Is server running?
   starting server anyway
   server starting
   LOG:  could not bind IPv4 socket: Address already in use
   HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
   LOG:  could not bind IPv6 socket: Address already in use
   HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
   WARNING:  could not create listen socket for "*"
   FATAL:  could not create any TCP/IP sockets

哦我的天啊..又来了一个...https://dev59.com/I2oy5IYBdhLWcg3wkO6g#8482546 - wildplasser
2
检查是否有正在运行的进程,使用 ps aux | grep postgres 命令查找并杀死它们,然后尝试启动您的服务器。 - Hedde van der Heide
1个回答

13

1-你的data目录可能是错误的。请确保使用正确的路径。

2-如果安装了多个postgres,则需要指定要使用哪个pg_ctl

我手动安装了Postgres 9.2,以下是如何启动它:

/Library/PostgreSQL/9.2/bin/pg_ctl -D /Library/PostgreSQL/9.2/data start

我通过HomeBrew安装了Postgres 9.1,以下是它的启动方式:

/usr/local/Cellar/postgresql/9.1.5/bin/pg_ctl -D /usr/local/var/postgres-9.1.5 start

1
但是如果手动安装,第一条命令需要postgresql用户权限才能运行。 - Dhiraj

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接