Support Questions

Find answers, ask questions, and share your expertise

postgres Connection: Error - Connection refused


I'm trying to install a cluster using Ambari.

I've made it all the way to step 7: Customize Services. At this point, the wizard is asking me to test the db connection to the embedded postgresql db. As you might have guessed, it's failing with the following message:

2018-05-17 04:09:26,200 - Check db_connection_check was unsuccessful. Exit code: 1. Message: May 17, 2018 4:09:26 AM org.postgresql.core.v3.ConnectionFactoryImpl log
WARNING: ConnectException occurred while connecting to Connection refused (Connection refused)
 at Method)
 at org.postgresql.core.PGStream.<init>(
 at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(
 at org.postgresql.core.ConnectionFactory.openConnection(
 at org.postgresql.jdbc.PgConnection.<init>(
 at org.postgresql.Driver.makeConnection(
 at org.postgresql.Driver.connect(
 at java.sql.DriverManager.getConnection(
 at java.sql.DriverManager.getConnection(
 at org.apache.ambari.server.DBConnectionVerification.main(

May 17, 2018 4:09:26 AM org.postgresql.Driver connect
SEVERE: Connection error: 
org.postgresql.util.PSQLException: Connection to refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

I've verified I can ping 'slave1' from the Ambari host machine and I've opened up port 5432 in the firewall. I'm really at a loss as to why the db won't connect.

For what it's worth, I'm installing on Google Cloud

The default params for the wizard are in the attachment



Super Mentor

@Mike Wong

As you are selecting "Existing Postgresql Database", So you will need to make sure that you have done the presetup for Hive to use External Existing Postgres.

When you use "Existing" database options then you will need to make sure that the Database is already installed on the mentioned host and it is running fine (port 5432) is accessible and bound.

# netstat -tnlpa | grep 5432
# ps -ef | grep postgres

Please see the doc to know

how to use Oozie with an existing database, other than the Derby database instance that Ambari installs by default.


I figured it out, for that problem at least.

I had to edit the pg_hba.conf file to add the IP range of 'host' machine.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.