Support Questions
Find answers, ask questions, and share your expertise

Error While Trying to Test Connection to Hive Database

Error While Trying to Test Connection to Hive Database

Explorer
2019-10-23 20:42:17,691 - Check db_connection_check was unsuccessful. Exit code: 1. Message: ERROR: Unable to connect to the DB. Please check DB connection properties.
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 546, in <module>
    CheckHost().execute()
  File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py", line 375, in execute
    method(env)
  File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 207, in actionexecute
    raise Fail(error_message)
resource_management.core.exceptions.Fail: Check db_connection_check was unsuccessful. Exit code: 1. Message: ERROR: Unable to connect to the DB. Please check DB connection properties.
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

I followed the steps outlined when you select "Existing PostgreSQL database", namely:

image.png

 

 

where I used: 

 

 

sudo yum install postgresql-jdbc

 

to install the package, and then

 

ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/share/java/postgresql-jdbc.jar

 

And setup completed successfully.

I'm making a test cluster with 3 machines on Azure, and cannot setup Hive..

Also I seem to not have a /var/lib/pgsql folder on my Ambari server like people reference in similar problems on the web, if that makes a difference.

2 REPLIES 2
Highlighted

Re: Error While Trying to Test Connection to Hive Database

Expert Contributor

@mkobe 

Check is Postgres i up and running and make sure pg_hba.conf file is connfigured correctly under /var/lib/psql/pg_hba.conf 

Highlighted

Re: Error While Trying to Test Connection to Hive Database

Explorer

 

 

 

[postgres@testvm1 ~]$ psql
psql (9.2.24)
Type "help" for help.

postgres=#

 

 

 

@Scharan Confirmed postgres is running.

Again, I don't seem to have a /var/lib/psql folder at all, despite postgres being installed...

 

It might help to say that I've designated Hive Metastore and HiveServer2 to be on a node that's not the postgres/ambari server node (from what I've heard it should not matter..)

 

UPDATE: I did find the pg_hba.conf file, just in a different location:

It shows the following:

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust