Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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
Master Guru

Sorry I have corrected port number, please try the steps given above and let me know how it goes

avatar
Master Guru

avatar
Master Guru

@Amit Dass - I'm assuming you have installed cluster with Ambari, Please go to the ambari server UI and check on which host hive metostore is installed, you can go to the hive services and click on metastore service to check the same.

If Ambari shows metastore as down then you need to start it.

avatar
Expert Contributor

@Kuldeep Kulkarni :No I am not using Ambari

I am using distributed system which has one namenode and two datanode . This for POC purpose only .

This is simple unix machine which had hadoop , hive ,hbase installed. Please guide me accordingly.

avatar
Super Guru

@Amit Dass

Can you please follow below steps and share the result?.

1. Find out the node which hosting hive metastore service, you can use ambari to figure out the ip/hostname for that node.

2. ssh root login to that hive metastore node and execute below commands.

bash# ps -aef|grep -i org.apache.hadoop.hive.metastore.HiveMetaStore

bash# lsof -i:9083

3. From some other node try connecting hivemetastore port using telnet.

bash# telnet <hivemeta server> 9083

If 9083 port is not occupied and ps command doesn't show any metastore process then please try to restart the hivemestore service from ambari UI and perform same check again.

avatar
Expert Contributor

@Jitendra Yadav : Thanks , I am using distributed system which has one namenode and two datanode . This for POC purpose only . Can you please elaborate more on this .

I logged in Namenode assume : xx.xx.xx.xx

Hadoop hdfs commands working fine.

But when I try to enter into hive shell it throwing error.

1. As hive installed in Namenode so we had IP of namenode.

2. ps -aef|grep -i org.apache.hadoop.hive.metastore.HiveMetaStore

o/p : hadoop 15097 13478 0 16:21 pts/2 00:00:00 grep -i org.apache.hadoop.hive.metastore.HiveMetaStore

lsof -i:9083

o/p : Did not get any output for the same

3. Getting connection refused .. telnet < Namenode IP> 9083

This is simple unix machine which had hadoop , hive ,hbase installed. Please guide me on this.

avatar
Super Guru

@Amit Dass

So looks like your hive metastore service is not running, Would you please try to start metastore service from ambari UI? please see attachement.screen-shot-2016-04-20-at-23103-pm.png

avatar
Super Guru

@Amit Dass

Please below command to start the hivemetastore..

su $HIVE_USER 
nohup /usr/hdp/current/hive-metastore/bin/hive --service metastore>/var/log/hive/hive.out 2>/var/log/hive/hive.log &

avatar
Super Guru

@Amit Dass

Hi Amit, if you run the below command from one terminal then metastore process will run into background and even if you close the terminal it shouldn't terminate the process. So please use it with nohup.

su $HIVE_USER 
nohup /usr/hdp/current/hive-metastore/bin/hive --service metastore >/var/log/hive/hive.out 2>/var/log/hive/hive.log &

avatar
Super Guru

@Amit Dass

Please accept my answer if this is now resolved after my suggestion.