snippetsqlModerate
How to check the syntax of pg_hba.conf and other postgresql conf files on ubuntu/debian/linux?
Viewed 0 times
postgresqlconftheubuntupg_hbaothersyntaxdebianfileslinux
Problem
Many times, the postgresql service can't restart after some configuration changes.
Is there any command line tool allowing to check the syntax of
Is there any command line tool allowing to check the syntax of
pg_hba.conf and other pg *.conf files before reloading/restarting the service, or even better, after any config change ?Solution
You can run:
.. from within
Any config validation errors will then get put into the Postgres log file, and it won't reload the config. Example log:
I'm not aware of a tool that just checks config for validity, but there was a thread on the pgsql-hackers mailing list here that discussed a proposal for a validator.
postgres=# SELECT pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
postgres=#.. from within
psql. or kill -HUP the postmaster process.Any config validation errors will then get put into the Postgres log file, and it won't reload the config. Example log:
2016-10-05 10:31:57 BST LOG: received SIGHUP, reloading configuration files
2016-10-05 10:31:57 BST LOG: invalid connection type "awdawdawdawd"
2016-10-05 10:31:57 BST CONTEXT: line 1 of configuration file "/etc/postgresql/9.3/main/pg_hba.conf"
2016-10-05 10:31:57 BST WARNING: pg_hba.conf not reloadedI'm not aware of a tool that just checks config for validity, but there was a thread on the pgsql-hackers mailing list here that discussed a proposal for a validator.
Code Snippets
postgres=# SELECT pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
postgres=#2016-10-05 10:31:57 BST LOG: received SIGHUP, reloading configuration files
2016-10-05 10:31:57 BST LOG: invalid connection type "awdawdawdawd"
2016-10-05 10:31:57 BST CONTEXT: line 1 of configuration file "/etc/postgresql/9.3/main/pg_hba.conf"
2016-10-05 10:31:57 BST WARNING: pg_hba.conf not reloadedContext
StackExchange Database Administrators Q#151456, answer score: 14
Revisions (0)
No revisions yet.