关于macos:无法在mac os x上重启postgres

cannot restart postgres on mac os x

本问题已经有最佳答案,请猛点这里访问。

我无法在Mac OS X上重启postgres服务器。
我怎样才能解决这个问题?

试过两种方式:

pg_ctl restart返回:

1
2
3
4
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导致:

1
2
3
4
5
6
7
8
9
10
   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


1 - 您的data目录可能有误。 确保使用正确的路径。

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

我手动安装了postgres 9.2,这是我如何启动它:

1
/Library/PostgreSQL/9.2/bin/pg_ctl -D /Library/PostgreSQL/9.2/DATA START

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

1
/usr/LOCAL/Cellar/postgresql/9.1.5/bin/pg_ctl -D /usr/LOCAL/var/postgres-9.1.5 START