this problem was happened last night when I was using Adempiere. My adempiere server crash, it hints that there are no database, It all happened suddenly and I don't why.
So I checked the netstat -nlp | grep 5432
, it shows as follow
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN -
tcp6 0 0 :::5432 :::* LISTEN -
unix 2 [ ACC ] STREAM LISTENING 150917 - /var/run/postgresql/.s.PGSQL.5432
and I try psql -U postgres -h localhost, it connected success, but when I try psql -U postgres -h 192.168.1.103
, it connected failed, showed as follow:
psql: could not connect to server: No route to host
Is the server running on host "192.168.1.103" and accepting
TCP/IP connections on port 5432?
Then I checked the pg_hba.conf and postgresql.conf, they are right, as follow:
host all all 192.168.1.0/24 md5
listen_addresses='*'
So I think my configuration is correct and I have connected successful before, it is odds can not connect now, could anyone help me, thanks?
"No route to host" means that it's possible the net problem , first ping 192.168.1.103; if it works ,than " telnet 192.168.1.103 5432" to see if the port is ok .
And it's not the pg_hba issue。
I'm running POstgres 9.5 on Centos 7 and had the same issue. From the client machine, I could ping and telnet into port 22. Then I performed a telnet into port 5432 from the client machine and had the error below.
[pegusr@test ~]$ telnet 192.168.xx.x1 5432
Trying 192.168.56.111...
telnet: connect to address 192.168.xx.1x: No route to host
Since this was a test env I just disabled the firewalld on the DB server i.e.
systemctl stop firewalld
And it has worked since. For production environments, ask your sysadmin to add a firewall rule from the client machine into port 543x of your DB server.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With