1、启动hive的时候出现这个问题,报错如下所示:
1 [hadoop@slaver1 conf]$ hive 2 3 Logging initialized using configuration in jar:file:/home/hadoop/soft/hive-0.13.1-cdh5.3.6/lib/hive-common-0.13.1-cdh5.3.6.jar!/hive-log4j.properties 4 Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient 5 at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:371) 6 at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:689) 7 at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:633) 8 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 9 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 10 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 11 at java.lang.reflect.Method.invoke(Method.java:606) 12 at org.apache.hadoop.util.RunJar.main(RunJar.java:212) 13 Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient 14 at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1426) 15 at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:63) 16 at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:73) 17 at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2625) 18 at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2644) 19 at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:365) 20 ... 7 more 21 Caused by: java.lang.reflect.InvocationTargetException 22 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 23 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) 24 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 25 at java.lang.reflect.Constructor.newInstance(Constructor.java:526) 26 at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1424) 27 ... 12 more 28 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 29 at org.apache.thrift.transport.TSocket.open(TSocket.java:185) 30 at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:351) 31 at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:219) 32 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 33 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) 34 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 35 at java.lang.reflect.Constructor.newInstance(Constructor.java:526) 36 at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1424) 37 at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:63) 38 at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:73) 39 at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2625) 40 at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2644) 41 at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:365) 42 at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:689) 43 at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:633) 44 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 45 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 46 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 47 at java.lang.reflect.Method.invoke(Method.java:606) 48 at org.apache.hadoop.util.RunJar.main(RunJar.java:212) 49 Caused by: java.net.ConnectException: Connection refused 50 at java.net.PlainSocketImpl.socketConnect(Native Method) 51 at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) 52 at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) 53 at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) 54 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 55 at java.net.Socket.connect(Socket.java:579) 56 at org.apache.thrift.transport.TSocket.open(TSocket.java:180) 57 ... 19 more 58 ) 59 at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:398) 60 at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:219) 61 ... 17 more
2、具体原因是我配置hive的hive.site.sh的时候配置了如下所示的内容,注释了就不报错了,这里先注释了: