This is the most common issue for PostgreSQL first run in Linux env:
configure the server to allow TCP/IP connections postgresql server
it can produce PostgeSQL cannot connect to database host
Here I’ll show how to fix it before you struggle with firewall and ports:
I’ve found ot here: 17.3. Starting the Database Server and How Do I Enable remote access to PostgreSQL database server?
My situation:
vi /var/lib/pgsql/data/pg_hba.conf
add the string:
host all all 10.10.29.0/24 trust
with my range and next config:
vi /var/lib/pgsql/data/postgresql.conf
add the string:
listen_addresses='*'
After that restart the service:
systemctl restart postgresql.service
also you can use an old ‘service postgresql restart’
[root@centst010 ~]# service postgresql restart Redirecting to /bin/systemctl restart postgresql.service
And here it is:
[root@centst010 ~]# netstat -anp | grep 5432 tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN tcp 0 0 192.168.1.40:5432 192.168.1.22:65369 ESTABLISHED tcp6 0 0 :::5432 :::* LISTEN