zoukankan      html  css  js  c++  java
  • hive 数据归档问题

    1、对数据进行归档

    alter table tableName archive partition(current='2020-07-02');
    

    报错如下:
    FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. org/apache/hadoop/tools/HadoopArchives
    查看hive的日志,日志文件在 ls /tmp/${USER}/hive.log
    java.lang.NoClassDefFoundError: org/apache/hadoop/tools/HadoopArchives

    3、分析
    hive在进行归档的时候需要使用到hadoop的archive相关的类,但是在hive的lib目录下面没有。
    2、解决办法:
    从hadoop的lib目录下拷贝archive相关类到hive的lib下面

    ① 找到相关类
    [hduser@yjt hive]$ find /data1/hadoop/hadoop/ -name *archive*
    ② 拷贝
    cp /data1/hadoop/hadoop/share/hadoop/tools/lib/hadoop-archives-2.9.2.jar /data1/hadoop/hive/lib/
    

    3、开启archive功能

    hive> set hive.archive.enabled=true;
    

    4、测试
    归档前:

    开始归档:

    hive> alter table hive_text archive partition(folder='docs');
    intermediate.archived is hdfs://yjt:9000/user/test/hive_text/folder=docs_INTERMEDIATE_ARCHIVED
    intermediate.original is hdfs://yjt:9000/user/test/hive_text/folder=docs_INTERMEDIATE_ORIGINAL
    Creating data.har for hdfs://yjt:9000/user/test/hive_text/folder=docs
    in hdfs://yjt:9000/user/test/hive_text/folder=docs/.hive-staging_hive_2020-07-07_14-39-31_376_7443789806325398792-1/-ext-10000/partlevel
    Please wait... (this may take a while)
    Moving hdfs://yjt:9000/user/test/hive_text/folder=docs/.hive-staging_hive_2020-07-07_14-39-31_376_7443789806325398792-1/-ext-10000/partlevel to hdfs://yjt:9000/user/test/hive_text/folder=docs_INTERMEDIATE_ARCHIVED
    Moving hdfs://yjt:9000/user/test/hive_text/folder=docs to hdfs://yjt:9000/user/test/hive_text/folder=docs_INTERMEDIATE_ORIGINAL
    Moving hdfs://yjt:9000/user/test/hive_text/folder=docs_INTERMEDIATE_ARCHIVED to hdfs://yjt:9000/user/test/hive_text/folder=docs
    OK
    
    

    归档后:

    5、解压归档文件

    hive> alter table hive_text unarchive partition(folder='docs');
    
  • 相关阅读:
    字符串作为map的key
    类成员函数模板特化
    函数模板特化
    linux 下第一个Libevent代码学习
    linux下libevent安装
    随笔
    SELECT INTO 和 INSERT INTO SELECT 两种表复制语句
    字符串处理总结之一(C#String类)
    XPath语法 在C#中使用XPath示例
    C#代码实现邮箱验证C#中及一些常用的正则表达式
  • 原文地址:https://www.cnblogs.com/yjt1993/p/13230694.html
Copyright © 2011-2022 走看看