Remote connection with Postgresql only works after PING

Asked

Viewed 90 times

1

I have a JAVA application running on one server and the database running on another.

Both servers are connected and on the same network, postgresql is enabled to receive external connections.

But when I try to connect to the database from the application machine, I get the refused connection error. But just I ping from the database server to the application machine that the connection will work.

Can anyone explain to me the reason and the solution of this problem?

Thank you!

  • 1

    Client (application) and server PostgresSQL are in the same network segment ? Are you absolutely sure that there is no firewall and/or a router between client and server ? What is the operating system of the server PostgreSQL ? The server on which the PostgreSQL has some kind of service firewall qualified ? SELinux qualified ? firewalld enabled ? Any rule of iptables ?

  • Q: Are the client (application) and the Postgressql server in the same network segment ? R: Yes! P: Are you absolutely sure that there is no firewall and/or router between the client and the server ? R: I don’t have access to the router, but ran nmap from the client and got the following result: PORT STATE SERVICE
80/tcp open http
445/tcp closed microsoft-ds
8080/tcp open http-proxy It seems that there is some rule blocking, but in iptables there is no rule. The operating system of both machines is UBUNTU 16.04. Selinux and firewalld are not enabled

  • Door 80!? The PostgreSQL does not usually listen at this door, by default the door is the 5432. Contact the router/firewall administrator and ensure that the client (application) is able to connect the port 5432 server (Postgressql). If there is a router/firewall out there, it is possible that the client/server is not on the same network.

  • Because it is...Postgresql is running on port 5432 itself. But the strange thing is that after I perform a ping from the database server to the application machine everything works normally. I’m finding this bizarre. I’ll contact the person in charge, as suggested. If the problem is this same I’ll come back here to warn you.

  • This behavior is also typical of a firewall/router. It is as if "something" authorized the client’s connection to the server because it assumed that the server "knows" the client due to ping attempt.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.