加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Postgresql启动失败

发布时间:2020-12-13 15:52:24 所属栏目:百科 来源:网络整理
导读:我正在尝试通过Openstack上的Fabric构建一个盒子.部分安装涉及安装和运行PostgreSQL. 这个命令工作正常: $sudo service postgresql initdb 此命令失败: $sudo service postgresql start 运行此命令时,失败的日志输出显示没有问题: $cat /var/lib/pgsql/pg
我正在尝试通过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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读