I have installed and configured PostgreSQL in one of our client computer and found that by default TCP/IP is not allowed.
When a client machine tried to connect PostgreSQL Server, it got a error like “psql:could not connect to server:Connection refused”.
If you require to connect your all clients with PostgreSQL server, you should perform below two actions.
Add client IP-Address range into pg_hba.conf :
pg_hba.conf is a configuration file which is controlled Client Authentication. This file automatically installed when the data directory is initialized.
Below is a default entry in pghba.conf file.
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
In our example, we have one client, IP-Address which is “10.0.0.12”. If you require to connect this client with PostgreSQL Server, please add below entry in pghba.conf and after that save this file and restart PostgreSQL Service.
host all all 10.0.0.12/24 md5
Another method is to change listen_addresses parameter in postgresql.conf :
In the PostgreSQL configuration file (postgresql.conf), by default listen address is “localhost” like,
listen_addresses = 'localhost'
Please change this parameter value from ‘localhost’ to ‘*’ so that all clients can connect from different networks.
listen_addresses = '*'
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.