我正在尝试安装并运行 postgresql

我正在尝试安装并运行 postgresql

我安装了 postgres 并尝试启动 postgres 服务,但出现错误

[root@c1152-node3 ~]# 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"?

[root@c1152-node3 log]# service postgres start
    Redirecting to /bin/systemctl start postgres.service
    Failed to start postgres.service: Unit not found.

我花了两天时间试图找出问题所在。最后,我安装了 postgresql-server。我仍然要启动 postgres 服务。但至少现在,我从 service xxxx start 命令中得到了有意义的响应。问题:- 下面两个包有什么区别?

Jul 31 17:39:56 Installed: postgresql-9.2.23-3.el7_4.x86_64
Aug 02 16:45:25 Installed: postgresql-server-9.2.23-3.el7_4.x86_64

现在:-

[root@c1152-node3 log]# systemctl status postgresql
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2018-08-02 16:46:35 UTC; 34min ago
  Process: 7817 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)
Failed to get boot id: No such file or directory

答案1

postgresql 是客户端,postgresql-server 是服务器。另请参阅

rpm -qi postgresql postgresql-server

答案2

谢谢@RalfFriedl

我终于能够通过以用户 postgres 身份登录并运行来启动我的 postgres

pg_ctl start -D /usr/local/pgsql/data/ -l logfile

service postgresql start仍然失败

相关内容