Support Questions

Find answers, ask questions, and share your expertise

Getting error while opening hive shell

avatar
Expert Contributor

$ hive

Logging initialized using configuration in jar:file:/chroot/hadoop/inst/hive/apache-hive-0.13.1-bin/lib/hive-common-0.13.1.jar!/hive-log4j.properties

Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:346) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.main(RunJar.java:212) Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1412) at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:62) at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:72) at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2453) at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2465) at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:340) ... 7 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1410) ... 12 more Caused by: MetaException(message:Could not connect to meta store using any of the URIs provided. Most recent failure: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused at org.apache.thrift.transport.TSocket.open(TSocket.java:185)

Please help to resolve this error.

29 REPLIES 29

avatar
Expert Contributor

@Amit Dass Can you please check Hive Metastore logs for any errors/exceptions. Assuming you are using mysql as Metadata. Further Can you check if mysql is running and you can ping/telnet to mysql with the setting in the hive-site.xml and connect mysql with username/pwd provided in hive-site.xml

avatar
Expert Contributor

Yes user name and passwords are there at <value> tag of : <name>javax.jdo.option.ConnectionUserName</name> , <name>javax.jdo.option.ConnectionPassword</name> . Can you please elloborate the steps to check whether mysql is working or not .

avatar
Expert Contributor

Have you checked hivemetastore.log, did you find any errors ?

avatar
Expert Contributor

Sorry can you please suggest where this file should be present? @nyakkanti

avatar
Expert Contributor

avatar
Master Guru

@Amit Dass - Looks like your HiveMetastore process is not running, I can see connection refused from the logs

Could not connect to meta store using any of the URIs provided. Most recent failure: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused at org.apache.thrift.transport.TSocket.open(TSocket.java:185)

Or there might be some connection issues with hive client and hive metastore machine.

Can you please check connectivity as well ?

avatar
Expert Contributor

@Kuldeep Kulkarni : Can you please brief that how should I check connectivity?

avatar
Master Guru

@Amit Dass

From hive client (from where you are running hive command) check if you are able to run below command

telnet <hive-metastore-hostname/ip-address> 9083

On metastore:

try running below command to check is metstore process is running

ps aux|grep HiveMetaStore

try running below command to ensure that metastore process is listening on 9038

root@sandbox ~]# netstat -tulpn|grep 9083
tcp        0      0 0.0.0.0:9083                0.0.0.0:*                   LISTEN      2115/java
[root@sandbox ~]#

avatar
Expert Contributor

@Kuldeep Kulkarni : Getting connection refused as below also why we use port 9038

telnet xx.xx.xx.xx 9038

Trying xx.xx.xx.xx... telnet: connect to address xx.xx.xx.xx: Connection refused