![](/img/trans.png)
[英]unable to start rstudio in centos getting error “unable to connect to service”
[英]Unable to start postgresql service on CentOS 7
無法在 CentOS 7 上啟動 postgresql-9.5。
我按照這個頁面 - https://wiki.postgresql.org/wiki/YUM_Installation - 在 CentOS 上安裝數據庫服務器。
我在設置setenforce 0
后嘗試了同樣的方法,但這也沒有幫助。
我正在以root
身份執行所有操作。
systemctl start postgresql-9.5.service
Job for postgresql-9.5.service failed because the control process exited with error
code. See "systemctl status postgresql-9.5.service" and "journalctl -xe" for details.
這是我獲得的地位 -
Redirecting to /bin/systemctl status postgresql-9.5.service
● postgresql-9.5.service - PostgreSQL 9.5 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-9.5.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2016-02-18 15:20:30 EST; 2min 28s ago
Process: 15041 ExecStartPre=/usr/pgsql-9.5/bin/postgresql95-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)
Feb 18 15:20:30 myserver systemd[1]: Starting PostgreSQL 9.5 database server...
Feb 18 15:20:30 myserver systemd[1]: postgresql-9.5.service: control process exited, code=exited status=1
Feb 18 15:20:30 myserver systemd[1]: Failed to start PostgreSQL 9.5 database server.
Feb 18 15:20:30 myserver systemd[1]: Unit postgresql-9.5.service entered failed state.
Feb 18 15:20:30 myserver systemd[1]: postgresql-9.5.service failed.
並且不同的conf文件的內容如下——
[root@myserver /]# cat /etc/ld.so.conf.d/postgresql-pgdg-libs.conf
/usr/pgsql-9.5/lib/
[root@myserver /]# cat /usr/lib/tmpfiles.d/postgresql-9.5.conf
d /var/run/postgresql 0755 postgres postgres -
[root@myserver /]# cat /usr/pgsql-9.5/share/postgresql-9.5-libs.conf
/usr/pgsql-9.5/lib/
[root@myserver /]# cat /etc/alternatives/pgsql-ld-conf
/usr/pgsql-9.5/lib/
[root@myserver /]# cat /var/lib/alternatives/pgsql-ld-conf
auto
/etc/ld.so.conf.d/postgresql-pgdg-libs.conf
/usr/pgsql-9.5/share/postgresql-9.5-libs.conf
950
谷歌搜索我看到的錯誤。 許多人都看到了同樣的錯誤,並且每種情況的根本原因都不同。 通讀這些帖子,我不清楚是否看到了任何已報告的原因。
確保在安裝之前正確安裝了所有軟件包並更新了 yum 存儲庫部分[base]
和[updates]
,如指南中所述。 我們有帶有 PostgreSQL 9.5 的 CentOS 7,它可以通過以下步驟完美運行:
vi /etc/yum.repos.d/CentOS-Base.repo
yum localinstall http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
yum list postgres*
yum install -y postgresql95-server.x86_64 postgresql95-contrib.x86_64 postgresql95-libs.x86_64
/usr/pgsql-9.5/bin/postgresql95-setup initdb
systemctl enable postgresql-9.5.service
systemctl start postgresql-9.5.service
最后, systemctl status postgresql-9.5.service
應該顯示如下內容:
postgresql-9.5.service - PostgreSQL 9.5 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-9.5.service; enabled)
Active: active (running) since Fri 2016-02-19 00:01:13 UTC; 6min ago
Process: 10809 ExecStart=/usr/pgsql-9.5/bin/pg_ctl start -D ${PGDATA} -s -w -t 300 (code=exited, status=0/SUCCESS)
Process: 10802 ExecStartPre=/usr/pgsql-9.5/bin/postgresql95-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 10811 (postgres)
CGroup: /system.slice/postgresql-9.5.service
├─10811 /usr/pgsql-9.5/bin/postgres -D /var/lib/pgsql/9.5/data
├─10812 postgres: logger process
├─10814 postgres: checkpointer process
├─10815 postgres: writer process
├─10816 postgres: wal writer process
├─10817 postgres: autovacuum launcher process
└─10818 postgres: stats collector process
最常見的問題是數據庫集群未初始化。 您可以通過使用initdb
命令運行 postgresql-XX-setup 腳本來輕松初始化它,例如
sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
然后啟動 Postgres 服務,例如
sudo systemctl start postgresql-11
接下來的步驟在我們的測試服務器上幫助了我。
通過 SSH 連接您的服務器。
然后切換用戶:
$ sudo su - postgres
檢查 Postgres 狀態:
pg_ctl 狀態
停止數據庫:pg_ctl 停止
檢查是否不存在服務器進程:ps axf|grep postg
啟動 Postgres 服務: sudo systemctl start postgresql.service 或 sudo systemctl start postgresql
然后檢查狀態:
systemctl status postgresql.service ИЛИ systemctl status postgresql
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.