Support Questions

Find answers, ask questions, and share your expertise

Cannot connect to Hive thru JDBC: Connection refused

avatar
Explorer

I've followed the Getting Started Guide, everything OK, and now I need to connect to Hive cluster via JDBC.
I have the following configuration:
Manager Node (cloudera1) 52.6.221.164
Worker Node 1 (cloudera2) 52.22.58.113
Worker Node 2 (cloudera3) 54.175.19.19
Worker Node 3 (cloudera4) 54.175.18.49
I have the following connection string:
jdbc:hive://52.22.58.113:10000/default;user=my_user;password=my_psw

 

When trying to establish a connection, the following exception is thrown by the driver:

[Cloudera][HiveJDBCDriver](500164) Error initialized or created transport for authentication: java.net.ConnectException: Connection refused: connect.

What's the right pair IP address - TCP port that I should use to connect?

Thank you
cghersi

1 ACCEPTED SOLUTION

avatar
Guru

The JDBC string might be a bit different for Hive Server 2, actually. This is what used to be used when Beeline (CLI JDBC client) was used instead of Hue for some steps in the tutorial:

 

 

beeline -u jdbc:hive2://[Manager Node IP Address]:10000/default -n admin -d org.apache.hive.jdbc.HiveDriver

The `-n admin` may not be correct to use in this case, but perhaps /default is what's required for your JDBC connection string?

 

 

View solution in original post

4 REPLIES 4

avatar
Guru

Reposting as it looks like my reply via email was made into a new thread:

 

If you're connecting to Impala, use the IP address of one of the Worker
Nodes, and use this query string:

jdbc:hive2://**:21050/;auth=noSasl

If you're connecting to Hive, then use the IP address of the Manager Node
and port 10000.

Because there isn't anything about the authentication for these services
that is configured beyond the default, these ports are blocked from
machines outside the cluster. If you want to connect from outside the
cluster, you will need to look up the Network ACL for your CloudFormation
stack, and edit that Network ACL to allow access on the ports you're using.

avatar
Explorer

Hi Sean,

thank you for your reply.

I tried to connect to the manager, unfortunately in this case the program get stuck in the DriverManager.getConnection() method.

I triple-checked the ACL rules and the TCP port 10000 is allowed, as well as 21050 of Impala. for Impala everything works, for Hive it doesn't.

Any other idea?

If you want you can contact me at cristiano.ghersi _at_ plat.one

Thank you very much

cghersi

avatar
Guru

The JDBC string might be a bit different for Hive Server 2, actually. This is what used to be used when Beeline (CLI JDBC client) was used instead of Hue for some steps in the tutorial:

 

 

beeline -u jdbc:hive2://[Manager Node IP Address]:10000/default -n admin -d org.apache.hive.jdbc.HiveDriver

The `-n admin` may not be correct to use in this case, but perhaps /default is what's required for your JDBC connection string?

 

 

avatar
Explorer

Hi Sean.

Finally the connection has been successful with the hive2 driver.

Thank you so much!

cghersi