Q: Why can't I connect to the postgresql database? The log file contains following statement.
2016-09-09 04:33:07 GMT 13316 export_etl_db FATAL: pg_hba.conf rejects connection for host "10.11.12.13", user "postgres", database "export_etl_db", SSL off
A: The error message indicates that a user called postgres was trying to access the database export_etl_db from the host 10.11.12.13 but was rejected due to access-restrictions.
To fix the problem, you need to configure the postgresql-server to allow access. This is done by editing the configuration file pg_hba.conf placed in the folder /etc/postgresql, adding the line host export_etl_db postgres 10.11.12.13/32 md5 so that the configuration file looks something like this:
This tells postgres to allow host access (netbased access) to the database export_etl_db for user postgres IF and only if the source IP is 10.11.12.13 and if the correct password is provided.
If the IP is likely to change (dhcp), you can set a netmask as 10.169.115.0/24.
If different users need access, one line per user is needed or, alternatively, you can type in the 'all' keyword which matches any user.
After editing the configuration file, you need to reload postgres.
From version 9.x: