Postgresql启动失败

前端之家收集整理的这篇文章主要介绍了Postgresql启动失败前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试通过Openstack上的Fabric构建一个盒子.部分安装涉及安装和运行Postgresql.

这个命令工作正常:

$sudo service postgresql initdb

此命令失败:

$sudo service postgresql start

运行此命令时,失败的日志输出显示没有问题:

$cat /var/lib/pgsql/pgstartup.log

此命令显示以下消息:

$cat /var/lib/pgsql/data/pg_log/postgresql-Wed.log

LOG: could not open configuration file
“/var/lib/pgsql/data/pg_hba.conf”: Permission denied
FATAL: could not load pg_hba.conf

执行这些命令时,我的用户具有以下组:

vagrant,wheel

我的用户位于/ etc / sudoers下的sudoers列表中,具有以下权限:

vagrant  ALL=(ALL) NOPASSWD: ALL

pergs on pgsql

[root@integration ~]# ls -ltr /var/lib/pgsql/
total 12
drwx------.  2 postgres postgres 4096 Sep 13  2012 backups
-rw-------.  1 postgres postgres 1152 Jun 19 20:17 pgstartup.log
drwx------. 12 postgres postgres 4096 Jun 19 20:19 data

和子目录数据:

[root@integration ~]# ls -ltr /var/lib/pgsql/data/
total 76
-rw-------. 1 postgres postgres     4 Jun 19 20:17 PG_VERSION
drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_twophase
drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_tblspc
drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_stat_tmp
drwx------. 4 postgres postgres  4096 Jun 19 20:17 pg_multixact
-rw-------. 1 postgres postgres 16886 Jun 19 20:17 postgresql.conf
-rw-------. 1 postgres postgres  1631 Jun 19 20:17 pg_ident.conf
drwx------. 3 postgres postgres  4096 Jun 19 20:17 pg_xlog
drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_subtrans
drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_clog
drwx------. 5 postgres postgres  4096 Jun 19 20:17 base
drwx------. 2 postgres postgres  4096 Jun 19 20:17 global
-rw-------. 1 postgres postgres   241 Jun 19 20:17 pg_hba.conf
drwx------. 2 postgres postgres  4096 Jun 19 20:17 pg_log
-rw-------. 1 postgres postgres    57 Jun 19 20:19 postmaster.opts

解决方法

结果证明这是一个selinux问题.
我禁用它并且很好.完整配置如下.

对于那些不在selinux上的人(像我一样直到今天),可以在以下位置找到配置:

/etc/selinux/config

它也可以暂时关闭,如下所示:

echo 0 > /selinux/enforce

完整配置

[root@integration selinux]# cat config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#   enforcing - SELinux security policy is enforced.
#   permissive - SELinux prints warnings instead of enforcing.
#   disabled - SELinux is fully disabled.
SELINUX=enforcing
# SELINUXTYPE= type of policy in use. Possible values are:
#   targeted - Only targeted network daemons are protected.
#   strict - Full SELinux protection.

猜你在找的Postgre SQL相关文章