当我运行sudo -u postgres psql时,它给出的错误为
psql: 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"?
所以我通过pg_lsclusters检查状态,它给出的状态为关闭
所以我尝试通过sudo pg_ctlcluster 11 main start启动集群,它给出的错误为
Job for <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4d3d223e392a3f283e3c210d7c7c60202c2423633e283f3b242e28" rel="noreferrer noopener nofollow">[email protected]</a> failed because the service did not take
the steps required by its unit configuration.
See "systemctl status <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="34445b47405346514745587405051959555d5a1a475146425d5751" rel="noreferrer noopener nofollow">[email protected]</a>" and "journalctl -xe" for
details.
然后我通过journalctl -xe检查日志,它给出了
-- Subject: Unit <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d7a7b8a4a3b0a5b2a4a6bb97e6e6fabab6beb9f9a4b2a5a1beb4b2" rel="noreferrer noopener nofollow">[email protected]</a> has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cebea1bdbaa9bcabbdbfa28effffe3a3afa7a0e0bdabbcb8a7adab" rel="noreferrer noopener nofollow">[email protected]</a> has begun starting up.
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: Error:
/usr/lib/postgresql/11/bin/pg_ctl /usr/lib/postgresql/11/bin/pg_ctl start -D
/data/aqu
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08
18:35:50.032 UTC [3622] LOG: listening on IPv4 address "0.0.0.0", port 5432
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08
18:35:50.032 UTC [3622] LOG: listening on IPv6 address "::", port 5432
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08
18:35:50.033 UTC [3622] LOG: listening on Unix socket
"/var/run/postgresql/.s.PGS
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08
18:35:50.090 UTC [3623] LOG: database system shutdown was interrupted;
last known
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08
18:35:50.140 UTC [3623] LOG: database system was not properly shut down;
automati
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08
18:35:50.147 UTC [3623] LOG: redo starts at 9D/44F48998
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08
18:35:53.483 UTC [3624] a2i@postgres FATAL: the database system is
starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08
18:35:54.422 UTC [3625] a2i@postgres FATAL: the database system is
starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:55.461 UTC [3626] a2i@postgres FATAL: the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:55.465 UTC [3627] a2i@postgres FATAL: the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:57.713 UTC [3628] a2i@postgres FATAL: the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:57.861 UTC [3623] LOG: redo done at 9D/AFFFFF98
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:59.416 UTC [3629] a2i@postgres FATAL: the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:03.493 UTC [3630] a2i@postgres FATAL: the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql
@11-main[3617]: 2019-05-08 18:36:04.431 UTC [3631] a2i@postgres FATAL: the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:05.471 UTC [3632] a2i@postgres FATAL: the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:05.477 UTC [3633] a2i@postgres FATAL: the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:06.776 UTC [3623] PANIC: could not write to file "pg_wal/xlogtemp.3623": No
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:06.959 UTC [3622] LOG: startup process (PID 3623) was terminated by signal
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:06.959 UTC [3622] LOG: aborting startup due to startup process failure
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:07.108 UTC [3622] LOG: database system is shut down
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: pg_ctl: could not start server
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: Examine the log output.
May 08 18:36:07 ip-10-0-1-87 systemd[1]: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="62120d111605100711130e2253534f0f030b0c4c110710140b0107" rel="noreferrer noopener nofollow">[email protected]</a>: Can't open PID file /var/run/postgresql/11-main.pid (yet?) after start: No such
May 08 18:36:07 ip-10-0-1-87 systemd[1]: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="60100f131407120513110c2051514d0d01090e4e13051216090305" rel="noreferrer noopener nofollow">[email protected]</a>: Failed with result 'protocol'.
May 08 18:36:07 ip-10-0-1-87 systemd[1]: Failed to start PostgreSQL Cluster 11-main.
-- Subject: Unit <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="35455a46415247504644597504041858545c5b1b465047435c5650" rel="noreferrer noopener nofollow">[email protected]</a> has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ccbca3bfb8abbea9bfbda08cfdfde1a1ada5a2e2bfa9bebaa5afa9" rel="noreferrer noopener nofollow">[email protected]</a> has failed.
--
-- The result is RESULT.
May 08 18:36:07 ip-10-0-1-87 sudo[3612]: pam_unix(sudo:session): session closed for user root
可能是数据库关闭不当导致的 我不需要诸如转储现有数据库并重新安装 postgres 并恢复它之类的解决方案。我有大数据,这将需要很多时间。 解决这个问题的灵魂是什么?
最佳答案
它在日志中说明了问题所在:
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:06.776 UTC [3623] PANIC: could not write to file "pg_wal/xlogtemp.3623": No
我看不到“否”后面的内容,因为看起来您切断了消息的这一部分。
但是,数据库服务器无法写入事务日志目录,并且非常明智地拒绝继续。停止你正在做的事情,对数据目录及其下面的所有文件进行完整备份,然后只有才能找出问题所在。
您不知道自己在做什么(或者如果不阅读错误日志就不会在这里发帖),并且您所做的任何其他事情很可能会使情况变得更糟。
明显需要检查的事情:
- 机器最近是否崩溃过?
- 您的磁盘空间是否已用完?
- 目录的权限是否已更改?
关于linux - 无法在 Linux 上启动 postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56047182/