PostgreSQL 9.6を利用して同期レプリケーションモードの設定を記載した後でPostgreSQLを再起動しようとしたところエラーとなりました。あるあるネタ。
# systemctl restart postgresql Job for postgresql.service failed because the control process exited with error code. See "systemctl status postgresql.service" and "journalctl -xe" for details.
で、とりあえず状況を status で確認すると下記のような状況に。
# systemctl status postgresql ● postgresql.service - PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since 月 2018-10-15 14:28:07 JST; 5s ago Process: 12015 ExecStop=/usr/local/pgsql/bin/pg_ctl stop -D ${PGDATA} -s -m fast (code=exited, status=0/SUCCESS) Process: 12017 ExecStart=/usr/local/pgsql/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE) Main PID: 11934 (code=exited, status=0/SUCCESS) 10月 15 14:28:06 pgrep-test1.local systemd[1]: Starting PostgreSQL database server... 10月 15 14:28:06 pgrep-test1.local pg_ctl[12017]: 2018-10-15 05:28:06 GMT LOG: inval...2" 10月 15 14:28:06 pgrep-test1.local pg_ctl[12017]: 2018-10-15 05:28:06 GMT DETAIL: sy...-" 10月 15 14:28:06 pgrep-test1.local pg_ctl[12017]: 2018-10-15 14:28:06 JST FATAL: con...rs 10月 15 14:28:07 pgrep-test1.local systemd[1]: postgresql.service: control process exi...=1 10月 15 14:28:07 pgrep-test1.local systemd[1]: Failed to start PostgreSQL database server. 10月 15 14:28:07 pgrep-test1.local systemd[1]: Unit postgresql.service entered failed ...e. 10月 15 14:28:07 pgrep-test1.local systemd[1]: postgresql.service failed. Hint: Some lines were ellipsized, use -l to show in full.
今回の原因
設定上は間違い無さそうなんだけどなぁ‥ と思いつついろいろ確認したところ原因が判明しまして、理由は「synchronous_standby_names のホスト名にハイフン(-)が含まれていた為」ということでした。まじかい。
どうやら synchronous_standby_names での指定時にハイフンをホスト名に含めているとNGとなるようです。
ご注意を!!