微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐