zoukankan      html  css  js  c++  java
  • Caused by: MetaException(message:Hive Schema version 2.1.0 does not match metastore's schema version 1.2.0 Metastore is not upgraded or corrupt)

    解决方案汇总:

    (1)删除HDFS上的hive数据与hive数据库
        hadoop fs -rm -r -f /tmp/hive
        hadoop fs -rm -r -f /user/hive
    (2)删除MySQL上的hive的元数据信息
        mysql -uroot -p 
        drop database hive
    (3)初始化hive, 将mysql作为hive的元数据库
        schematool -dbType mysql -initSchema    

    错误及操作详情:

    1 启动hive报错

    # hive
    which: no hbase in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/src/jdk1.8.0_112/bin:/usr/local/src/hadoop-2.7.3/bin:/usr/local/src/apache-hive-2.1.1-bin/bin:/home/pl62716/spark-2.1.0-bin-hadoop2.6/bin:/home/pl62716/apache-maven-3.3.9/bin://home/pl62716/sbt-launcher-packaging-0.13.13/bin:/root/bin)
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/usr/local/src/apache-hive-2.1.1-bin/lib/hive-jdbc-2.1.1-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/usr/local/src/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/usr/local/src/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
    
    Logging initialized using configuration in jar:file:/usr/local/src/apache-hive-2.1.1-bin/lib/hive-common-2.1.1.jar!/hive-log4j2.properties Async: true
    Java HotSpot(TM) Server VM warning: You have loaded library /usr/local/src/hadoop-2.7.3/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.
    It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
    Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
            at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:591)
            at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:531)
            at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705)
            at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
            at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
    Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
            at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:226)
            at org.apache.hadoop.hive.ql.metadata.Hive.<init>(Hive.java:366)
            at org.apache.hadoop.hive.ql.metadata.Hive.create(Hive.java:310)
            at org.apache.hadoop.hive.ql.metadata.Hive.getInternal(Hive.java:290)
            at org.apache.hadoop.hive.ql.metadata.Hive.get(Hive.java:266)
            at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:558)
            ... 9 more
    Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
            at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1654)
            at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:80)
            at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:130)
            at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:101)
            at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:3367)
            at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3406)
            at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3386)
            at org.apache.hadoop.hive.ql.metadata.Hive.getAllFunctions(Hive.java:3640)
            at org.apache.hadoop.hive.ql.metadata.Hive.reloadFunctions(Hive.java:236)
            at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:221)
            ... 14 more
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1652)
            ... 23 more
    Caused by: MetaException(message:Hive Schema version 2.1.0 does not match metastore's schema version 1.2.0 Metastore is not upgraded or corrupt)
            at org.apache.hadoop.hive.metastore.ObjectStore.checkSchema(ObjectStore.java:7768)
            at org.apache.hadoop.hive.metastore.ObjectStore.verifySchema(ObjectStore.java:7731)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:101)
            at com.sun.proxy.$Proxy21.verifySchema(Unknown Source)
            at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:565)
            at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:626)
            at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:416)
            at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:78)
            at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:84)
            at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:6490)
            at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:238)
            at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:70)
            ... 28 more
    error

    2 删除HDFS上的hive数据与hive数据库

    hadoop fs -rm -r -f /tmp/hive

    hadoop fs -rm -r -f /user/hive

    [Dev root @ sd-9c1f-2eac ~]
    # hadoop fs -rm -r -f /tmp/hive
    Java HotSpot(TM) Server VM warning: You have loaded library /usr/local/src/hadoop-2.7.3/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.
    It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
    17/03/23 22:38:06 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
    17/03/23 22:38:07 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 0 minutes, Emptier interval = 0 minutes.
    Deleted /tmp/hive
    [Dev root @ sd-9c1f-2eac ~]
    # hadoop fs -rm -r -f /user/hive
    Java HotSpot(TM) Server VM warning: You have loaded library /usr/local/src/hadoop-2.7.3/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.
    It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
    17/03/23 22:38:10 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
    17/03/23 22:38:11 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 0 minutes, Emptier interval = 0 minutes.
    Deleted /user/hive

    3 删除MySQL上的hive的元数据信息

    mysql -uroot -p

    drop database hive

    # mysql -uroot -p 
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 3039
    Server version: 5.6.30 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> drop database hive;

    4 异常

    # hive
    which: no hbase in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/src/jdk1.8.0_112/bin:/usr/local/src/hadoop-2.7.3/bin:/usr/local/src/apache-hive-2.1.1-bin/bin:/home/pl62716/spark-2.1.0-bin-hadoop2.6/bin:/home/pl62716/apache-maven-3.3.9/bin://home/pl62716/sbt-launcher-packaging-0.13.13/bin:/root/bin)
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/usr/local/src/apache-hive-2.1.1-bin/lib/hive-jdbc-2.1.1-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/usr/local/src/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/usr/local/src/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
    
    Logging initialized using configuration in jar:file:/usr/local/src/apache-hive-2.1.1-bin/lib/hive-common-2.1.1.jar!/hive-log4j2.properties Async: true
    Java HotSpot(TM) Server VM warning: You have loaded library /usr/local/src/hadoop-2.7.3/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.
    It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
    Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
            at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:591)
            at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:531)
            at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705)
            at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
            at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
    Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
            at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:226)
            at org.apache.hadoop.hive.ql.metadata.Hive.<init>(Hive.java:366)
            at org.apache.hadoop.hive.ql.metadata.Hive.create(Hive.java:310)
            at org.apache.hadoop.hive.ql.metadata.Hive.getInternal(Hive.java:290)
            at org.apache.hadoop.hive.ql.metadata.Hive.get(Hive.java:266)
            at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:558)
            ... 9 more
    Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
            at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1654)
            at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:80)
            at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:130)
            at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:101)
            at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:3367)
            at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3406)
            at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3386)
            at org.apache.hadoop.hive.ql.metadata.Hive.getAllFunctions(Hive.java:3640)
            at org.apache.hadoop.hive.ql.metadata.Hive.reloadFunctions(Hive.java:236)
            at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:221)
            ... 14 more
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1652)
            ... 23 more
    Caused by: MetaException(message:Version information not found in metastore. )
            at org.apache.hadoop.hive.metastore.ObjectStore.checkSchema(ObjectStore.java:7753)
            at org.apache.hadoop.hive.metastore.ObjectStore.verifySchema(ObjectStore.java:7731)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:101)
            at com.sun.proxy.$Proxy21.verifySchema(Unknown Source)
            at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:565)
            at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:626)
            at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:416)
            at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:78)
            at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:84)
            at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:6490)
            at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:238)
            at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:70)
            ... 28 more

    5 初始化hive, 将mysql作为hive的元数据库

    # schematool -dbType mysql -initSchema 

     

  • 相关阅读:
    python爬取网页
    python异常处理
    本周总结
    改变promise状态有三种resolve、reject、throw
    详解Promise.race()可以解决多个异步请求那个请求先返回
    Promise.all()方方详解
    你不知道的Promise构造函数Promise(excutor)
    你不知道的Promise状态变化机制
    Promise练习文件读取
    关于async函数的错误处理
  • 原文地址:https://www.cnblogs.com/liupuLearning/p/6610307.html
Copyright © 2011-2022 走看看