设为首页 加入收藏

TOP

简单的项目使用flume,hive,sqoop,flume
2019-02-17 14:12:01 】 浏览:119
Tags:简单 项目 使用 flume hive sqoop
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011955252/article/details/58585178

这是一个自动化的脚本,每天定时启动使用crontab进行配置即可

CURRENT=`/bin/date +%y%m%d`

数据清洗
#/usr/local/hadoop-2.4.1/bin/hadoop jar /home/hadoop/cleaner.jar /flume/$CURRENT /cleaned/$CURRENT

#/usr/local/apache-hive-0.13.0-bin/bin/hive -e "alter table bbs add partition (logdate=$CURRENT) location '/cleaned/$CURRENT'"
数据分析
#/usr/local/apache-hive-0.13.0-bin/bin/hive -e "select count(*) from bbs where logdate = $CURRENT"

#/usr/local/apache-hive-0.13.0-bin/bin/hive -e "select count(distinct ip) from bbs where logdate = $CURRENT"

#/usr/local/apache-hive-0.13.0-bin/bin/hive -e "select count(*) from bbs where logdate = $CURRENT and instr(url, 'member.phpmod=register')>0;"

#/usr/local/apache-hive-0.13.0-bin/bin/hive -e "create table vip_$CURRENT row format delimited fields terminated by '\t' as select ip, count(*) as vtimes from bbs where logdate = $CURRENT group by ip having vtimes >= 50 order by vtimes desc limit 20"
数据导出到关系型数据句酷
/usr/local/sqoop-1.4.4/bin/sqoop export --connect jdbc:mysql://192.168.1.100:3306/usertable--username root --password 123 --export-dir "/user/hive/warehouse/vip_$CURRENT" --table vip --fields-terminated-by '\t'
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇log4j:ERROR Flume append() fail.. 下一篇Linux下Hadoop+Flume的日志系统搭..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目