'Connection refused.Check that hostname and port are correct and the postmaster is accepting TCP/IP connections

I have Virtual Box installed where two instances of Centos are running. Lets call them Centos 1 and Centos 2. I have successfully setup Confluence application on Centos with localhost Postgres DB in Centos 1.

The Problem:

When I am trying to setup confluence in Centos 2 it requires DB Connection If I provide the URL with the jdbc syntax it does not connect to the DB instance of Centos 1.

JDBC URL: jdbc:postgresql://192.168.56.13:5432/confluence

The Error:org.postgresql.util.PSQLException: Connection refused.Check that hostname and port are correct and the postmaster is accepting TCP/IP connections.

The nmap command from instance two to instance 1 is successful.

I am trying to edit the configuration as shown below https://confluence.atlassian.com/confkb/confluence-postgresql-jdbc-direct-connection-refused-683543784.html

But I get a error when I give the command service postgresql restart I guess it is not taking my entry of host all all 192.168.56.105 trust

Please Clarify.



Solution 1:[1]

Try changing all peer authentication entries with md5 in your postgres's pg_hba.conf file. this way the authorization will work

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Miad Abrin