zoukankan      html  css  js  c++  java
  • 052 自动将每日的日志增量导入到hive中

    一:大纲介绍

    1.导入方式

      load data local inpath 'local_file_path' into table tbname partition (date='',hour='');

    2.获取数据源

      20161114/2016111402.log

           /2016111403.log

           /2016111404.log

              ..........

    3.hive准备

      导入分区表

    二:准备

    1.日志目录准备

      日志目录:/etc/opt/datas/log_hive

      日志的文件夹:20161114

      

    2.hive准备

    在hive中创建分区表

      

    3.有源数据

      

    4.新建脚本,并赋予执行权限

      

    5.获取前一天的时间

      注意加上执行符。

      

    6.显示日志目录

      

    7.使用 -e 加载数据

      

     8.效果

      

      

    9.第二种方式加载的准备数据

      

    9.使用 -f 加载数据

      )新建文件hive.sql

      

      )shell语句

      重点:$HIVE_HOME/bin/hive --hiveconf log_dir=$LOG_DIR --hiveconf file=$FILE --hiveconf day=$DAY --hiveconf hour=$HOUR --hiveconf tbname=$HIVE_TB -f /etc/opt/datas/log_hive/hive.sql

      

      )效果

      

      )HDFS上效果

       

    10.整体查询

      

        

      

  • 相关阅读:
    hlgoj 1766 Cubing
    Reverse Linked List
    String to Integer
    Bitwise AND of Numbers Range
    Best Time to Buy and Sell Stock III
    First Missing Positive
    Permutation Sequence
    Next Permutation
    Gray Code
    Number of Islands
  • 原文地址:https://www.cnblogs.com/juncaoit/p/6065876.html
Copyright © 2011-2022 走看看