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

ログ: '/var/lib/pgsql/data/pg_hba.conf' 構成ファイルを開けません。権限が拒否されました。致命的:pg_hba.confをロードできません。

私のユーザーは、このコマンドを実行すると次のグループがあります。

vagrant, wheel

私のユーザーは、 sudoers次の権限を持つリストにあります。/etc/sudoers

vagrant  ALL=(ALL) NOPASSWD: ALL

権限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

とサブディレクトリ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

ベストアンサー1

実行してもsudo実際にPostgreSQLを起動できることを確認するので、次のことを試してみましょう。

$ sudo su -
$ service postgresql start

上記のコマンドを使用してサービスを開始できる場合、vagrant アカウントは sudo とサービスを開始できません。

おすすめ記事