PostgreSQL 服务状态为活动(已退出),但我能够连接

PostgreSQL 服务状态为活动(已退出),但我能够连接

我在 GCD 上的新 Ubuntu (16.04) VM 上安装了 PostgreSQL (9.5)。服务状态为活动(已退出)。输出为sudo systemctl status postgresql

● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Tue 2020-04-14 17:50:34 UTC; 25min ago
  Process: 2291 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 2291 (code=exited, status=0/SUCCESS)
    Tasks: 0
   Memory: 0B
      CPU: 0
   CGroup: /system.slice/postgresql.service

Apr 14 17:50:34 c systemd[1]: Starting PostgreSQL RDBMS...
Apr 14 17:50:34 c systemd[1]: Started PostgreSQL RDBMS.

然而 pg_lsclusters 显示集群处于在线状态。

Ver Cluster Port Status Owner    Data directory               Log file
9.5 main    5432 online postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log

我还可以交互登录并使用 psql。没有错误。

我正在尝试设置 scalelite (https://github.com/blindsidenetworks/scalelite/blob/master/docker-README.md

当我跑步时

systemctl status scalelite-api.service scalelite-nginx.service

我收到以下错误:

could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Address not available
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
Couldn't create 'scalelite' database. Please check your configuration.
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Address not available
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?

请帮助我解决这个问题,另外服务状态 active(exited) 是什么意思。

抱歉,信息不完整/不足。我是这个领域的新手。

答案1

就我而言,原因是服务器空间不足。因此,postgresql 无法写入数据并停止监听其端口。我删除了未使用的文件并重新启动了 PostgreSQL,然后它就正常工作了。

cd /
# Check available space
df -hd 1
# delete unused files
find / -type f -name "*unused-file-names*" -delete
# Restart PostgreSQL service
systemctl restart postgresql

相关内容