【发布时间】:2020-01-23 19:37:24
【问题描述】:
Linux 薄荷。 PostgreSQL 11.
我正在尝试:psql -U postgres
并接收:
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"
在 postgresql.conf 中:
listen_addresses = '*'
unix_socket_directories = '/var/run/postgresql'
unix_socket_permissions = 0777
在 ps axf | 之后grep postgres:
6575 ? Sl 0:01 | | \_ xed /etc/postgresql/11/main/postgresql.conf
4906 pts/0 S 0:00 \_ sudo su postgres
4907 pts/0 S 0:00 \_ su postgres
6586 pts/0 S+ 0:00 \_ grep --color=auto postgres
但是
root@andrej-HP-290-G1-SFF-Business-PC:/etc/postgresql/11/main# netstat -nltp | grep 5432
root@andrej-HP-290-G1-SFF-Business-PC:/etc/postgresql/11/main#
我是如何解决这个问题的:
ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
-
sudo find /tmp/ -name .s.PGSQL.5432
结果:/tmp/.s.PGSQL.5432。并在 su 下尝试:psql -U postgres
运行 'pg_lsclusters',我明白了:
11 main 5432 down postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
所以,状态下降。但是当我尝试“pg_ctlcluster 11 main start”时,我收到:
Job for postgresql@11-main.service failed because the service did not
take the steps required by its unit configuration.
See "systemctl status postgresql@11-main.service" and "journalctl -xe"
for details.
执行“journalctl -xe”:
failed to create Unix-сокет in "/tmp
system bd is switched-off
failde to start server
Can't open PID file /run/postgresql/11-main.pid (yet?) after start:
No such file or dir
Failed with result 'protocol'.
Failed to start PostgreSQL Cluster 11-main.
【问题讨论】:
-
检查这个链接也许它会帮助你。 stackoverflow.com/questions/31645550/…
-
使用这个链接,进入“pg_lsclusters”后发现,状态为down
标签: linux postgresql sockets