2013-06-20 228 views
4

我試圖在Openstack上通過Fabric構建一個盒子。部分安裝涉及安裝和運行PostgreSQL。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:無法打開配置文件 「/var/lib/pgsql/data/pg_hba.conf」:權限被拒絕 FATAL:無法加載的pg_hba.conf

我的用戶而執行這些命令有以下組:

vagrant, wheel 

我的用戶在sudoers列表/etc/sudoers這些權限下:

在個
vagrant ALL=(ALL) NOPASSWD: ALL 

燙髮:

[[email protected] ~]# 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 

和子DIR data

[[email protected] ~]# 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 
+0

Cross在Unix和Linux上發佈:http://unix.stackexchange.com/questions/80066/postgresql-service-start-issues – slm

回答

1

事實證明,這是一個SELinux的問題。 我禁用它,並很好。下面的完整配置。

對於那些你的arent了對SELinux的(比如我直到今天)的配置中可以找到:

/etc/selinux/config 

它也可以臨時關閉是這樣的:

echo 0 > /selinux/enforce 

Full config

[[email protected] 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. 
+0

'setenforce 0'也可以使用。 –