zoukankan      html  css  js  c++  java
  • Hive 报错:java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

    在配置好hive后启动报错信息如下:

     1 [walloce@bigdata-study-104 hive-0.13.1-cdh5.3.6]$ bin/hive
     2 
     3 Logging initialized using configuration in file:/opt/modules/cdh/hive-0.13.1-cdh5.3.6/conf/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

    hive的配置hive-site.xml内容如下:

     1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
     2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
     3 
     4 
     5 <configuration>
     6     <property>
     7         <name>hive.metastore.warehouse.dir</name>
     8         <value>/user/hive/warehouse</value>
     9     </property>
    10     <property>
    11         <name>hive.exec.mode.local.auto</name>
    12         <value>true</value>
    13         <description> Let Hive determine whether to run in local mode automatically </description>
    14     </property>
    15     <property>
    16         <name>hive.metastore.uris</name>
    17         <value>thrift://bigdata-study-104:9083</value>
    18         <description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
    19     </property>
    20     <property>
    21         <name>javax.jdo.option.ConnectionURL</name>
    22         <value>jdbc:mysql://bigdata-study-104:3306/hive?createDatabaseIfNotExist=true</value>
    23     </property>
    24     <property>
    25         <name>javax.jdo.option.ConnectionDriverName</name>
    26         <value>com.mysql.jdbc.Driver</value>
    27     </property>
    28     <property>
    29         <name>javax.jdo.option.ConnectionUserName</name>
    30         <value>root</value>
    31     </property>
    32     <property>
    33         <name>javax.jdo.option.ConnectionPassword</name>
    34         <value>123456</value>
    35     </property>
    36     <!-- 显示表的列名 -->
    37     <property>
    38       <name>hive.cli.print.header</name>
    39       <value>true</value>
    40     </property>
    41     
    42     <!-- 显示数据库名称 -->
    43     <property>
    44       <name>hive.cli.print.current.db</name>
    45       <value>true</value>
    46     </property>
    47 </configuration>

    hive的配置文件hive-env.sh的内容如下:

    1 # Set HADOOP_HOME to point to a specific hadoop install directory
    2 HADOOP_HOME=/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6
    3 
    4 # Hive Configuration Directory can be controlled by:
    5 export HIVE_CONF_DIR=/opt/modules/cdh/hive-0.13.1-cdh5.3.6/conf

    经过报错信息提示分析,可以看出是因为metastore的原因,解决方案有两种:

    1、由于配置好以后,metastore服务没有启动。启动metastore:

      bin/hive --service metastore &

    2、如果没有用到hive的metastore服务,可以先注释掉,注释代码如下:

      

    <!--<property>
            <name>hive.metastore.uris</name>
            <value>thrift://bigdata-study-104:9083</value>
            <description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
    </property>-->

    按照以上步骤处理后,重新启动hive,问题即解决。

    初心回归,时光已逝!
  • 相关阅读:
    RS-232 vs. TTL Serial Communication(转载)
    UART to Serial Terminal(转载)
    UART Explained(转载)
    Gprinter热敏打印机光栅位图点阵数据解析工具
    WinCE非通用调试工具汇总
    WinCE下GPRS自动拨号软件(GPRS AutoDial)
    WinCE项目应用之车载导航
    mysql创建临时表,将查询结果插入已有的表
    mysql利用navicat导出表结构和表中数据
    mysql查看表的属性 mysql将查询结果给临时变量
  • 原文地址:https://www.cnblogs.com/yin1361866686/p/8682863.html
Copyright © 2011-2022 走看看