[英]PostgreSQL server can not start
我已經重新啟動了 Ubuntu 服務器,其中我有版本 12 的 PostgreSQL 數據庫。
我通過鍵入以下命令啟動了數據庫服務器
sudo service postgresql start
當我檢查狀態時
sudo service postgresql status
它顯示數據庫服務器像這樣處於活動狀態,
Active: active (exited) since Thu 2020-07-16 12:28:41 UTC; 14min ago
Process: 5875 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 5875 (code=exited, status=0/SUCCESS)
但是,我不斷收到此錯誤,並且在執行 netstat 或 htop 時找不到此 PID。
Connection to IP_ADDRESS:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
我看到了類似的問題,他們通過將偵聽地址設置為 localhost 或 0.0.0.0 並將端口號設置為 5432 來解決,我這樣做了,但我仍然遇到無法連接到數據庫的錯誤。
當我執行 pg_lsclusters 時,我也收到此錯誤
11 main 5433 down postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
12 main 5432 down postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
有人可以幫我弄清楚為什么會這樣嗎?
非常感謝。
也許它只在本地主機上收聽? 試試netstat -an | grep -i "listen "
netstat -an | grep -i "listen "
查看系統上正在監聽哪些端口。 也許 IP 地址在您重新啟動后發生了變化?
查看 postgresql 日志,那里有消息嗎?
sudo su - postgres
並嘗試使用psql
連接。
ps -fu postgres
查看以 postgresql 用戶身份運行的進程。
我首先通過 systemctl 啟用 Postgres 服務
systemctl enable postgresql.service
然后,我啟動了一個特定版本的 PostgreSQL 數據庫服務器
pg_ctlcluster 11 main start
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.