I have an application that uses Postgres as the database to store application-related data. During my initial setup, I have found the above error in the application while connecting the database.
From the above error, we can clearly understand that Postgres is not accepting any connection from 10.244.1.94 IP address. As you know Postgres has host-based access control which accepts the database connection from the listed host.
In order to solve this error, we need to add an entry in the pg_hba.conf ( which is the host-based access control file which is located in the Postgres data folder) which is by default located at /var/lib/postgres/data/dbfiles location. Note that this location may get changed if you have any custom data location.
Once you identify the location open the file and add the below entry, where it allows access to all databases for all users with encrypted password.
Note that you can change 0.0.0.0/0 to network mask where you application is trying to connect. In my case Im using 0.0.0.0/0.
And add the below line in postgres.conf
Once you do all the changes do restart for the Postgres or timescaleDB service.
© 2021, Techrunnr. All rights reserved.