linux - CentOS 7无法启动postgresql服务

标签 linux postgresql centos centos7 rhel

无法在 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],如 guide 中所述.我们有 CentOS 7 和 PostgreSQL 9.5,它可以通过以下步骤完美运行:

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 

关于linux - CentOS 7无法启动postgresql服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35492893/

相关文章:

linux - 在 bash 脚本中使用 -s 命令

linux - 用于检查文件中的路由器和接口(interface)列表上的 ATM 接口(interface)速度的 Bash 脚本

sql - 在 Go 中为 PGSQL 函数提供参数

node.js - heroku 服务器上的幽灵博客密码验证失败

mysql - nginx 连接()失败(110 : Connection timed out)

linux - 具有带模板参数的函数的模板类上的 Cppcheck 语法错误

linux - 重新加载 Flash 17 次会导致错误 #2046 并需要重新启动浏览器

sql - 选择查询需要更长的时间才能返回结果

php - 在 CentOS 中升级到 PHP 7 禁用 SimpleXML mod

centos - 具有许多 ips 的后缀