将ETL过后的数据以parquet的存储方式导入hive

本文介绍了如何将经过ETL处理的数据以Parquet格式存储并导入到Hive。首先,处理源日志文件得到清洗后的数据。其次,在Hive中创建外部表并指定存放位置。接着,将清洗后的文件移动到Hive表目录下。然后,执行分区刷新操作。最后,创建新的Parquet表,配置压缩方式和动态分区选项。
摘要由CSDN通过智能技术生成
[hadoop@hadoop-01 shell]$ cat g6-train-hadoop2.sh 

process_date=20180717
echo "step1: mapreduce etl"
hadoop jar /home/hadoop/lib/g6-hadoop-1.0.jar com.ruozedata.hadoop.mapreduce.driver.LogETLDriver /g6/hadoop/accesslog/$process_date /g6/hadoop/access/output/day=$process_date

echo "step2:数据移动到DW"
hdfs dfs -rm -r /g6/hadoop/access/clear/*
hdfs dfs -mv /g6/hadoop/access/output/day=$process_date  /g6/hadoop/access/clear/
echo "step3:刷元数据"
hive -e "use g6hadoop; alter table g6_access add if not exists partition (day=$process_date);"
echo "step4: 创建parquet表"
hive -e "use g6hadoop;set parquet.compression=gzip;set hive.exec.dynamic.partition = true;set hive.exec.dynamic.partition.mode = nonstrict;
insert into g6_access_parquet partition(day) select * from g6_access ; "

第一步:
原日志:20180717.txt。
经过ETL过后的文件在output目录
第二步

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值