Linux下Shell编程实现基于Hadoop的ETL(流程篇)
来源:互联网 发布:奇迹服务端源码 编辑:程序博客网 时间:2024/05/17 02:43
加群:397706991,共同学习
具体Shell代码下载:http://download.csdn.net/detail/luo849278597/9490920
conf/flow.sh
<?xml version="1.0" encoding="UTF-8"?><root><!-- 配置调度模块 --><task type="import.sh">../conf/import.xml</task><!-- 数据导入模块 --><task type="hive.sh">../conf/hive.xml</task><!-- 数据分析模块 --><task type="export.sh">../conf/export.xml</task><!-- 数据导出模块 --></root>
bin/flow.sh
#! /bin/bash###########################################sed命令是Shell编程中用于处理字符串,过滤出所需字符串的命令 #tr -d '\r' 用于删除每行中的换行符###########################################get the environmentif [ -f ~/.bashrc ];then . ~/.bashrcfi#file exitif [ -z $1 ];thenecho 'USAGE:COMMAND FILENAME'exit 0fibin=`dirname "$0"`bin=`cd "$bin"; pwd`declare -i j=0declare -a commandsdeclare -a filescontent=`sed -e 's/\s*\(.*\)\s*$/\1/g' -e 's/\s*\(=\)\s*/\1/g' -e '/^\(\s\)*$/d' -e '/^$/d' $1`while read linedo \if echo ${line}|grep -qE "^<task" ; thencommand=`echo ${line}|sed -n -e 's/<task type=\"//' -e 's/\">.*<\/task>//' -e 's/<!--.*-->//p'|tr -d '\r'`file=`echo ${line}|sed -n -e 's/<task type=\".*\">//' -e 's/<\/task>//' -e 's/<!--.*-->//p'|tr -d '\r'`if [ ${#file} -ne 0 ] ; thencommands[$j]="$command"files[$j]="$file"let j++fifidone \<<EOF$contentEOFflow='echo "flow.sh excute begin" && 'for((i=0;i<${#commands[*]};i++))do flow="${flow}${bin}/${commands[$i]} ${files[$i]} && "done flow="${flow}echo \"flow.sh excute finined!\""eval $flow
0 0
- Linux下Shell编程实现基于Hadoop的ETL(流程篇)
- Linux下Shell编程实现基于Hadoop的ETL(分析篇)
- Linux下Shell编程实现基于Hadoop的ETL(导入篇)
- Linux下Shell编程实现基于Hadoop的ETL(分析篇)
- Linux下Shell编程实现基于Hadoop的ETL(Sqoop封装篇)
- Linux下Shell编程实现基于Hadoop的ETL(导出篇)
- Linux下基于bluez与obex的服务端实现流程
- Linux下的shell编程
- linux下的shell编程
- linux下的shell编程
- Linux的Shell编程Shell程序设计的流程控制
- Linux下如何实现shell多线程编程
- 基于Hadoop生态圈的数据仓库实践 —— ETL
- Linux Shell编程-流程控制
- ETL的文档流程
- linux下shell登录流程
- Linux下Shell编程
- linux下shell编程
- iOS-计时器发送验证码
- ambari安装报错Registration with the server failed.
- 配置多数据源及多个的jdbcTemple
- 关于字符编码以及BOM(字节顺序标记(ByteOrderMark))
- CentOS 上 Jenkins 安装
- Linux下Shell编程实现基于Hadoop的ETL(流程篇)
- 设置tr的border-bottom不生效解决
- 通过SecureCRT设置代理,访问网络中web界面
- 在Altium Designer 9中如何实现元器件旋转45°放置
- yum 安装包使用问题
- tomcat下配置https
- CDH 的Cloudera Manager免费与收费版的对比表
- 修改hadoop的备份系数dfs.replication后操作
- maven管理Spring MVC项目pom.xml配置