I have a Postgres instance running on an Azure VM, which is inside an Azure Virtual Network, and the VM has a hostname. Connecting with PostgreSQL using the IP address works, but when I try to connect using the hostname it gives this error:

psql: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

Pinging to the hostname works. The connection goes through a DNS forwarder. The configurations of /postgresql.conf looks like this:

listen_addresses = '*'  
tcp_keepalives_idle = 120              
tcp_keepalives_interval = 30                                                  
tcp_keepalives_count = 9               

and it currently accepts all connections /pg_hba.conf

   all             all                  md5

What is the cause of this issue, and how can it be solved?

  • Is the IP which you can successfully connect to the same one which ping reports for the hostname?
    – jjanes
    Jun 28 at 15:09
  • @jjanes That could be that case, there is another publicly registered/listed domain name which I use inside the VNet as DNS zone. I will give an update
    – YusufD
    Jun 28 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.