簡體   English   中英

無法在linux上啟動postgres

[英]Can't start postgres on linux

當我運行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檢查狀態,它將狀態顯示為down

所以我嘗試通過sudo pg_ctlcluster 11主啟動啟動集群,它給出了錯誤

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檢查日志,它給出了

-- Subject: Unit postgresql@11-main.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit postgresql@11-main.service 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]: postgresql@11-main.service: 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]: postgresql@11-main.service: 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 postgresql@11-main.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit postgresql@11-main.service 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

我看不出“No”之后會發生什么,因為看起來你切斷了那部分信息。

但是,數據庫服務器無法寫入事務日志目錄,並且非常明智地拒絕繼續。 停止你正在做的事情,對你的數據目錄和下面的所有文件進行完整備份, 然后再找出問題所在。

你不知道你在做什么(或者你不會在沒有閱讀錯誤日志的情況下在這里發帖)並且很有可能你做的任何其他事情都會使情況變得更糟。

要檢查的明顯事項:

  • 機器最近崩潰了嗎?
  • 你的磁盤空間不足嗎?
  • 是否已更改目錄的權限?

對我來說,這是通過更改bin目錄的權限來解決的。

chmod 755 /bin

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM