07-天亮大数据系列教程之streaming运行流程与shell实现wordcount
来源:互联网 发布:58网络销售工作怎么样 编辑:程序博客网 时间:2024/06/08 05:40
目录
1、streaming运行流程
2、streaming任务提交与shell实现wordcount
3、常用参数支持
详情
1、streaming运行流程
Java标准版运行流程
streaming运行流程
在worker处存在差异,通过stdin/stdout将PipeMapper和StreamingMapper打通
2、streaming任务提交与shell实现wordcount步骤实现
- 数据准备
- map编写
- reduce编写
- driver不再需要写了…….
- yarn jar提交
- 结果查看
步骤详情
数据准备
- hdfs目录
- hdfs目录
shell map编写
shell reduce编写
shell运行
- 本地测试
- 本地测试
集群执行模板
- 数据准备
通用模板:yarn jar streaming_jar_path.jar [genericOptions] [streamingOptions]细化模板 :yarn jar streaming_jar_path.jar \ -D configKey =configValue \ -input inputDirs \ -output outputDirs \ -mapper scriptMapper \ -reducer scriptReducer \ -file uploadFile
- 样例(shell实现wordcount案例)
yarn jar /usr/hdp/2.4.3.0-227/hadoop-mapreduce/hadoop-streaming.jar \-Dmapred.output.compress=false \-Dmapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec \-Dmapred.reduce.tasks=1 \-input /tmp/tianliangedu/input \-output /tmp/tianliangedu/output73 \-mapper "sh mapper_shell.sh" \-reducer "sh reducer_shell.sh" \-file mapper_shell.sh \-file reducer_shell.sh
- 输出效果
3、常用参数支持
- 通用系统参数传递
- 设置job名称 : -Dmapreduce.job.name=”jobName”
- 是否压缩输出:-Dmapred.output.compress=true
- 压缩格式设置:-Dmapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec
- 设置reduce数量:-Dmapred.reduce.tasks=1
- 批量上传文件:-files,此为hadoop generic参数,要放到参数的最前边跟-D一样传输
yarn jar /usr/hdp/2.4.3.0-227/hadoop-mapreduce/hadoop-streaming.jar \-files mapper_shell.sh,reducer_shell.sh \-Dmapred.output.compress=false \-Dmapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec \-Dmapred.reduce.tasks=1 \-Dstream.map.output.field.separator=\001 \-input /tmp/tianliangedu/input \-output /tmp/tianliangedu/output76 \-mapper "sh mapper_shell.sh" \-reducer "sh reducer_shell.sh" \
- 设置map的输出分隔符:-Dstream.map.output.field.separator =\t
- 设置map输出的时候key的组成:-Dstream.num.map.output.key.fields = 4
设置自定义的比较器: -Dmapreduce.job.output.key.comparator.class = org.apache.hadoop.mapreduce.lib.partition.KeyFieldBasedComparator
streamingy应用参数传递
- 上传一个文件:-file , 此为streaming参数
- 设定mapper执行文件:-mapper
- 设定reducer执行文件:-reducer
- 设定输入文件目录:-input
- 设定输出文件目录 : -output
- 设定自定义分区器: -partitioner=org.apache.hadoop.mapred.lib.KeyFieldBasedPartitioner
阅读全文
0 0
- 07-天亮大数据系列教程之streaming运行流程与shell实现wordcount
- 03-天亮大数据系列教程之分布式计算框架Map/Reduce运行流程与应用
- 08-天亮大数据系列教程之python streaming编程
- 11-天亮大数据系列教程之搭建web项目
- 04-天亮大数据系列教程之分布式资源管理与任务调度框架Yarn
- 05-天亮大数据系列教程之公司虚拟化架构与Gitlab搭建
- 09-天亮大数据系列教程之hive之udf/udaf/udtf
- 06-天亮大数据系列教程之hadoop二次排序详解
- 10-天亮大数据系列教程之virtualbox_nat模式下客户端链接主机端
- 01-天亮大数据系统教程之初识Hadoop
- 02-天亮大数据系统教程之分布式文件系统HDFS
- 2 大数据实战系列-spark shell wordcount
- 大数据之路-WordCount系列-1-问题
- 大数据系列之(一) Streaming模式基础知识
- spark streaming 实现接收网络传输数据进行WordCount功能
- hadoop系列学习之WordCount运行详解
- Streaming(C++)实现WordCount
- spark streaming初试之wordcount
- 教老婆学前端系列一,怎么清除浮动,clearfix方案
- JS引用类型
- Mac环境 quick-cocos2dx 3.6.2 项目在android studio下的真机测试
- 工作中遇到的一些 小问题
- 移动端Ajax返回消息替代Alert弹窗组件
- 07-天亮大数据系列教程之streaming运行流程与shell实现wordcount
- kafka常用代码
- 每天一道算法题——斐波那契数列
- Eclipse中安装 TestNG插件
- java程序员从笨鸟到菜鸟之(三十四)File
- Invalid Host header
- spring bean定义和自动注入
- 读zk 节点 报空指针
- Linux_Mysql环境配置