Postgresql

我正在嘗試安裝和執行 postgresql

  • October 25, 2019

我安裝了 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

postgresql 是客戶端,postgresql-server 是伺服器。也可以看看

rpm -qi postgresql postgresql-server

謝謝@RalfFriedl

我終於能夠通過以使用者 postgres 登錄並執行來啟動我的 postgres

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

service postgresql start仍然失敗

引用自:https://serverfault.com/questions/924668