By default, PostgreSQL database server only allow localhost access. When setting up an PostgreSQL in a cluster environment. Here are some hints for you to quick figure out what to do.

Networking configuration

First you have to make sure client and server can see each other, then setup iptable rules for PostgreSQL. If in an trusted LAN environment, client and server already set to widely open and trusted, then skip this part.

Make sure iptables is not blocking communication, open port 5432(or the port you changed from default)

append rules to your iptables scripts or file /etc/sysconfig/iptables:

iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d <pg server ip> --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s <pg server ip> --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

Restart firewall:

# /etc/init.d/iptables restart

Enable PostgreSQL Host Based Authentication

You need edit the PostgreSQL configuration file, edit the PostgreSQL Host Based Authentication configuration file pg_hba.conf, by default it's in the PostgreSQL initialized data directory, for 9.3, it's in

/var/lib/pgsql/9.3/data/pg_hba.conf

It has 7 different authentication formats, chose one for you.  I use the commonly used one as an example:

host    database  user  address  auth-method  [auth-options]
So, the record should look like this:

host testdb testuser 10.0.1.0/24 trust

Note: suppose the client ips are in 10.0.1 subnet. You can find more detail configuration of pg_hba.conf in

http://www.postgresql.org/docs/9.4/static/auth-pg-hba-conf.html

Allow TCP/IP socket

In the configuration file postgresql.conf, by default it's in PostgreSQL initialized data directory, for 9.3, it's in

/var/lib/postgresql.conf
Find configuration line that read as follows:
listen_addresses='localhost'

Next set IP address(es) to listen on; you can use comma-separated list of addresses; defaults to 'localhost', and '*' is all ip address:
listen_addresses='*'

Or just bind to you PostgreSQL server ip address, for example:

listen_addresses='10.0.1.5'
Save and restart the PostgreSQL database

Test your setup

Use psql command from client system. Connect to remote server using IP address 10.10.29.50 and login using vivek username and sales database, enter:

$ psql -h <pg server ip> -U testuser testdb