• 在hive中执行sql语句:SemanticException org.apache.hadoop.hive.ql.metadata.HiveException:


    hive> show databases;
    FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
    
    

    解决方案:

    在hive的配置文件hive-site.xml添加如下配置:

     <property>
        <name>datanucleus.schema.autoCreateAll</name>
        <value>true</value>
      </property>
    

    然后删除MySQL中原来的表,重新初始化元数据

    drop database hive_metastore;
    Query OK, 57 rows affected (0.42 sec)
    
    MariaDB [(none)]> create database hive_metastore;
    Query OK, 1 row affected (0.18 sec)

    初始化元数据:

    [xiaoqiu@s150 /soft/hive/conf]$ schematool -dbType mysql -initSchema

    如果没有删除原来映射到MySQL中的表的话会报如下错误:org.apache.hadoop.hive.metastore.HiveMetaException

    [xiaoqiu@s150 /soft/hive/conf]$ schematool -dbType mysql -initSchema
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/soft/apache-hive-2.3.3-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/soft/hadoop-2.7.5/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]
    Metastore connection URL:        jdbc:mysql://192.168.109.150:3306/hive_metastore?createDatabaseIfNotExist=true
    Metastore Connection Driver :    com.mysql.jdbc.Driver
    Metastore connection User:       root
    Starting metastore schema initialization to 2.3.0
    Initialization script hive-schema-2.3.0.mysql.sql
    Error: Duplicate key name 'PCS_STATS_IDX' (state=42000,code=1061)
    org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
    Underlying cause: java.io.IOException : Schema script failed, errorcode 2
    Use --verbose for detailed stacktrace.
    *** schemaTool failed ***
    欢迎关注我的公众号:小秋的博客 CSDN博客:https://blog.csdn.net/xiaoqiu_cr github:https://github.com/crr121 联系邮箱:rongchen633@gmail.com 有什么问题可以给我留言噢~
  • 相关阅读:
    浮动 float
    display属性和特性
    盒子阴影
    内边距
    外边距
    边框
    网页背景
    猴子补丁
    设计模式创造者模式--python
    Go语言:validator库对请求参数校验
  • 原文地址:https://www.cnblogs.com/flyingcr/p/10326883.html
Copyright © 2020-2023  润新知