###前提・実現したいこと
CentOS 7.3にPostgreSQL9.6.2をインストールし、systemctlから起動しようとしています。
PostgreSQLはyumではなく、rpmで以下のファイルをインストールしています。
postgresql96-server-9.6.2-2PGDG.rhel6.x86_64 postgresql96-libs-9.6.2-2PGDG.rhel6.x86_64 postgresql96-contrib-9.6.2-2PGDG.rhel6.x86_64 postgresql96-9.6.2-2PGDG.rhel6.x86_64 postfix-2.10.1-6.el7.x86_64
またsystemctl起動のために、/etc/systemd/system/postgresql.serviceというファイルを作成しました。
[Unit] Description=PostgreSQL 9.6.2 After=network.target remote-fs.target nss-lookup.target [Service] User=postgres Group=postgres Type=notify Environment=PGDATA=/psql/data ExecStart=/usr/pgsql-9.6/bin/pg_ctl -w start -D ${PGDATA} ExecStop=/usr/pgsql-9.6/bin/pg_ctl -w stop -m fast [Install] WantedBy=multi-user.target
###発生している問題・エラーメッセージ
systemctl start postgresqlを実行したところ、起動後にすぐに停止してしまいます。
journalctl
1Apr 17 16:23:01 hostname systemd[1]: Starting PostgreSQL 9.6.2... 2Apr 17 16:23:01 hostname pg_ctl[18384]: waiting for server to start....< 2017-04-17 16:23:01.675 JST > LOG: redirecting log output to logging collector process 3Apr 17 16:23:01 hostname pg_ctl[18384]: < 2017-04-17 16:23:01.675 JST > HINT: Future log output will appear in directory "/prdlog/psql". 4Apr 17 16:23:02 hostname pg_ctl[18384]: done 5Apr 17 16:23:02 hostname pg_ctl[18384]: server started 6Apr 17 16:23:03 hostname pg_ctl[18395]: waiting for server to shut down.... done 7Apr 17 16:23:03 hostname pg_ctl[18395]: server stopped 8Apr 17 16:23:03 hostname polkitd[562]: Unregistered Authentication Agent for unix-process:18378:44387497 (system bus name :1.5139, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus) 9Apr 17 16:23:03 hostname systemd[1]: Started PostgreSQL 9.6.2. 10
psコマンドで確認してもやはり起動していません
[postgres@hostname ~]$ ps -ef | grep postgres root 17332 10254 0 16:05 pts/2 00:00:00 su - postgres postgres 17333 17332 0 16:05 pts/2 00:00:00 -bash root 18343 10208 0 16:22 pts/1 00:00:00 su - postgres postgres 18344 18343 0 16:22 pts/1 00:00:00 -bash postgres 18434 18344 0 16:24 pts/1 00:00:00 ps -ef postgres 18435 18344 0 16:24 pts/1 00:00:00 grep --color=auto postgres
###試したこと
postgresユーザーでコマンドを実行すると問題なく起動されます。
[postgres@hostname ~]$ pg_ctl -w start waiting for server to start....< 2017-04-17 16:25:35.153 JST > LOG: redirecting log output to logging collector process < 2017-04-17 16:25:35.153 JST > HINT: Future log output will appear in directory "/prdlog/psql". done server started [postgres@hostname ~]$ ps -ef | grep postgres root 17332 10254 0 16:05 pts/2 00:00:00 su - postgres postgres 17333 17332 0 16:05 pts/2 00:00:00 -bash root 18343 10208 0 16:22 pts/1 00:00:00 su - postgres postgres 18344 18343 0 16:22 pts/1 00:00:00 -bash postgres 18540 1 0 16:25 pts/1 00:00:00 /usr/pgsql-9.6/bin/postgres postgres 18541 18540 0 16:25 ? 00:00:00 postgres: logger process postgres 18543 18540 0 16:25 ? 00:00:00 postgres: checkpointer process postgres 18544 18540 0 16:25 ? 00:00:00 postgres: writer process postgres 18545 18540 0 16:25 ? 00:00:00 postgres: wal writer process postgres 18546 18540 0 16:25 ? 00:00:00 postgres: autovacuum launcher process postgres 18547 18540 0 16:25 ? 00:00:00 postgres: stats collector process postgres 18549 18344 0 16:25 pts/1 00:00:00 ps -ef postgres 18550 18344 0 16:25 pts/1 00:00:00 grep --color=auto postgres [postgres@hostname ~]$ psql -l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+-----------+----------+---------+-------+------------------------- dvdrental | zz01adm01 | UTF8 | C | C | postgres | postgres | UTF8 | C | C | template0 | postgres | UTF8 | C | C | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | C | C | =c/postgres + | | | | | postgres=CTc/postgres zipcode | zz01adm01 | UTF8 | C | C | =T/zz01adm01 + | | | | | zz01adm01=CTc/zz01adm01 (5 rows)
CentOS7でsystemctl start postgresがエラーも参考にしてみたのですが、うまくいきません。
どなたがこの問題解決方法をご存知でしょうか
回答1件
あなたの回答
tips
プレビュー