Created 07-05-2017 07:30 PM
I am running the hive jdbc example with the following connect line :
Connection con = DriverManager.getConnection("jdbc:hive2://hadoop2.tolls.dot.state.fl.us:10001/default", "", "");
it compiles fine but on run time I get this error :
[hdfs@hadoop1 ~]$ java -cp .:$HADOOP_CLASSPATH:/usr/hdp/2.5.3.0-37/* HiveAlterRenameTo ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Exception in thread "main" java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://hadoop2.tolls.dot.state.fl.us:10001/default: java.net.ConnectException: Connection refused (Connection refused) at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:209) at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107)
here is what I have already tried :
1- changed port from 10000 to 10001
2- checked if port is listening and if FW is not blocking it . port is up and listening and not blocked from the client.
[root@hadoop2 hive]# netstat -tnlpa | grep 10000 tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 723/java tcp 0 0 10.100.44.16:33288 10.100.44.16:10000 TIME_WAIT - [root@hadoop2 hive]# ... 8 more [hdfs@hadoop1 ~]$ telnet hadoop2 10000 Trying 10.100.44.16... Connected to hadoop2. Escape character is '^]'. ^] telnet>
Created 07-05-2017 07:34 PM
As you are able to telnet "hadoop2" host on port 10000 hence you should alter your code to use the hostname as "hadoop2"
Example:
Connection con = DriverManager.getConnection("jdbc:hive2://hadoop2:10000/default", "", "");
.
On Hive Server2 Host please run the following command to know what is it's actual Hostname (FQDN)
# hostname -f
.
If your client machine where you are running the Hive Client Java code then FQDN of HiveServer2 should be resolvable or else you will have to make changes in your "/etc/hosts" file to make the Hive FQDN resolvable from your client machine.
Created 07-05-2017 07:43 PM
hi Jay
hostname -f gives
hadoop2.tolls.dot.state.fl.us
and telnet works fine to this FQDN also from hadoop1
[hdfs@hadoop1 ~]$ telnet hadoop2.tolls.dot.state.fl.us 10000 Trying 10.100.44.16... Connected to hadoop2.tolls.dot.state.fl.us. Escape character is '^]'. ^] telnet> quit [hdfs@hadoop1 ~]$
Created 07-05-2017 07:46 PM
In your code i see that you are using port 10001 Is that a typo mistake?
Connection con =DriverManager.getConnection("jdbc:hive2://hadoop2.tolls.dot.state.fl.us:10001/default","","");
Created 07-05-2017 08:00 PM
hi Jay I saw a post on this site advising to use this port since that's the port thrift hive server is using , I tried both , 10000 and 10001 but both fails with connection refused.
Created 07-05-2017 11:53 PM
Port number should be 10000. I see that your Hiveserver2 is listening on 10000.
Can you please double check?
Doc Ref - https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients
Hope this helps.
Created 07-06-2017 02:18 PM
but I said I used port 10000 and its not working either
what other reasons could be for this error ?
Created 07-10-2017 06:21 AM
Please check the metastore and hiveserver2 logs (just to confirm if they started fine or noe). Also, check if the user which fires the connection command has proper permission for the '/user/hive' folder in the hdfs.