Wednesday, December 14, 2022

Windows pg_hba.conf issue - FATAL: could not load pg_hba.conf

 Error or issue:

-bash-4.2$ psql -U barman -h 10.0.2.5 -p 5432 -d postgres
psql: error: connection to server at "10.0.2.5", port 5432 failed: FATAL:  could not load pg_hba.conf
You have new mail in /var/spool/mail/barman
-bash-4.2$


Issue:

An entry of the below form added

host    all barman              10.0.2.9 trust
host    all streaming_barman    10.0.2.9 trust

Actual entry should look like below (FIX):

host    all barman              10.0.2.9/32 trust
host    all streaming_barman    10.0.2.9/32 trust


Test:

-bash-4.2$ psql -U barman -h 10.0.2.5 -p 5432 -d postgres
psql (15.1, server 14.6)
Type "help" for help.

postgres=# exit

All looks good now.

Postgres expects subnet mask to be part of the host entry.

If you make an invalid entry in pg_hba.conf. Try reload the postgresql db and check the postgres log to know which line has issues...


Error log which gave the clue:

2022-12-14 12:47:37.105 PST [3560] LOG:  received SIGHUP, reloading configuration files
2022-12-14 12:47:37.112 PST [3560] LOG:  parameter "archive_mode" cannot be changed without restarting the server
2022-12-14 12:47:37.113 PST [3560] LOG:  configuration file "C:/Users/Administrator/PostgreSQL/14/data/postgresql.conf" contains errors; unaffected changes were applied
2022-12-14 12:47:37.114 PST [3560] LOG:  invalid IP mask "trust": Unknown host
2022-12-14 12:47:37.114 PST [3560] CONTEXT:  line 96 of configuration file "C:/Users/Administrator/PostgreSQL/14/data/pg_hba.conf"
2022-12-14 12:47:37.114 PST [3560] LOG:  pg_hba.conf was not reloaded


That was a quick post!!


Thanks

No comments:

Post a Comment

Flashback data archive steps

 Objective: Ways to track DML changes in a table Detailed objective: We should be able to track the changes in the table at any point in tim...