我尝试在postgresql.conf中取消注释'unix_socket_directories ='/ var / run / postgresql'。
但是这样做之后,当我尝试重新启动postgresql时,我收到了
Job for postgresql.service failed because the control process exited with error code. See
"systemctl status postgresql.service" and "journalctl -xe" for details.
寻找journalctl,我看到了:
LOG: could not bind Unix socket: Address already in use
HINT: Is another postmaster already running on port 5432? If not, remove socket file
"/var/run/postgresql/.s.PGSQL...and retry.
: WARNING: could not create Unix-domain socket in directory "/var/run/postgresql"
完整堆栈:
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled;
vendor preset: disabled)
Active: failed (Result: exit-code) since Ср 2020-01-29 13:39:52 MSK;
27s ago
Process: 2937 ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast
(code=exited, status=1/FAILURE)
Process: 2550 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p
${PGPORT} -w -t 300 (code=exited, status=0/SUCCESS)
Process: 2544 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA}
(code=exited, status=0/SUCCESS)
Main PID: 2554 (code=killed, signal=KILL)
plesk.iline.pro systemd[1]: Starting PostgreSQL database server...
plesk.iline.pro pg_ctl[2550]: LOG: could not bind Unix socket:
Address already in use
plesk.iline.pro pg_ctl[2550]: HINT: Is another postmaster already
running on port 5432? If not, remove socket file
"/var/run/postgresql/.s.PGSQL...and retry.
plesk.iline.pro pg_ctl[2550]: WARNING: could not create Unix-
domain socket in directory "/var/run/postgresql"
plesk.iline.pro systemd[1]: Started PostgreSQL database server.
2 plesk.iline.pro systemd[1]: postgresql.service: main process
exited, code=killed, status=9/KILL
plesk.iline.pro pg_ctl[2937]: pg_ctl: could not send stop signal
(PID: 2554): No such process
plesk.iline.pro systemd[1]: postgresql.service: control process
exited, code=exited status=1
plesk.iline.pro systemd[1]: Unit postgresql.service entered failed
state.
plesk.iline.pro systemd[1]: postgresql.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
答案 0 :(得分:1)
很可能在同一端口上还有另一台PostgreSQL服务器运行。
您应该执行PostgreSQL建议的操作:
ls -l /var/run/postgresql/.s.PGSQL.5432
应该有一个套接字文件。
然后,以用户root
的身份查看端口上是否有PostgreSQL进程在监听:
sudo fuser /var/run/postgresql/.s.PGSQL.5432
如果有结果,则实际上是在端口5432上运行了另一个PostgreSQL服务器。要么停止该服务器,要么为群集选择其他端口。
如果没有结果,则插座可能遗留了下来。删除它,然后重试。