我通过自制软件安装postgresql9.4.5。 在9.4.5之前,我使用9.3.9 macport,但我只想使用自制软件。 所以我卸载9.3.9和macport并安装9.4.5 by homebrew。
我可以成功" initdb / usr / local / var / postgres"。 但是,当我输入" postgres -D / usr / local / var / postgres"时,显示错误。
The error
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.
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.
WARNING: could not create listen socket for "localhost"
FATAL: could not create any TCP/IP sockets
我想手动启动服务器
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
但是,pg_ctl -D /usr/local/var/postgres status
显示pg_ctl: no server running
。
我确认了pg_hba.conf并显示
# IPv4 local connections:
host all all 127.0.0.1/32 trust
此外,当我输入psql
时,会显示错误psql: FATAL: could not open relation mapping file "global/pg_filenode.map": No such file or directory
我需要做什么?请告诉我。
添加附言
我也试过ps aux | grep postgres
postgres 276 0.0 0.0 2470236 452 ?? Ss 火12AM 0:03.18 postgres: stats collector process
postgres 275 0.0 0.0 2614684 1160 ?? Ss 火12AM 0:11.63 postgres: autovacuum launcher process
postgres 274 0.0 0.0 2614552 416 ?? Ss 火12AM 0:00.79 postgres: wal writer process
postgres 273 0.0 0.0 2614552 440 ?? Ss 火12AM 0:00.81 postgres: writer process
postgres 272 0.0 0.0 2614552 596 ?? Ss 火12AM 0:00.07 postgres: checkpointer process
postgres 242 0.0 0.0 2614552 1184 ?? S 火12AM 0:01.07 /opt/local/lib/postgresql93/bin/postgres -D /opt/local/var/db/postgresql93/defaultdb
root 75 0.0 0.0 2469228 884 ?? Ss 火12AM 0:00.03 /opt/local/bin/daemondo --label=postgresql93-server --start-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql93-server/postgresql93-server.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql93-server/postgresql93-server.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql93-server/postgresql93-server.wrapper restart ; --pid=none
这表明某些进程处于活动状态。并且,2行显示macport pass。但是,我删除了/ opt / local文件夹
我杀了这些进程,ps aux | grep postgres
没有显示任何内容。
所以,我试过postgres -D /usr/local/var/postgres
。下次,显示
LOG: database system was shut down at 2015-11-19 18:45:38 JST
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
并且,终端停止并且没有显示提示。所以我必须输入' control + c'
但是,我可以手动启动postgres。我做了这个命令pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
我可以做psql
命令。