Hadoop 1.x MapReduce最小驱动配置
来源:互联网 发布:python sql注入脚本 编辑:程序博客网 时间:2024/06/03 06:57
MapReduce中最小驱动配置指的是没有Mapper和Reducer,看如下代码:
package org.dragon.hadoop.mr;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.Path;import org.apache.hadoop.mapreduce.Job;import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;/** * 最小的MapReduce:不需要Mapper和Reducer * @author Administrator * */public class MinimalMapReduce {//Mapper//Reducerpublic static void main(String[] args) throws Exception {args = new String[]{"hdfs://hadoop-master.dragon.org:9000/opt/data/test/input/simple_file.txt","hdfs://hadoop-master.dragon.org:9000/opt/data/test/output7/"};//confConfiguration conf = new Configuration();//create jobJob job = new Job(conf,MinimalMapReduce.class.getSimpleName());//set jobjob.setJarByClass(MinimalMapReduce.class);//set in/out pathFileInputFormat.addInputPath(job, new Path(args[0]));FileOutputFormat.setOutputPath(job, new Path(args[1]));//submit jobboolean isSuccess = job.waitForCompletion(true);//exitSystem.exit(isSuccess?0:1);}}
针对上述的MapReduce程序,结果分析如下:
* 最小配置的MapReduce:读取输入文件中的内容,输出到指定目录的输出文件中,此时文件中的内容为 * key:原输入文件每行内容的起始位置 * value:输入文件每行的原始内容 * 所以,输出文件的内容为:key + \t + value
通过查看源代码,可以得到默认的mapper和reducer,主要源码类为JobContext:
//查看源码,可以得知如下默认配置//默认的输入格式job.setInputFormatClass(TextInputFormat.class);//default mapperjob.setMapperClass(Mapper.class);job.setMapOutputKeyClass(LongWritable.class);job.setMapOutputValueClass(Text.class);//default reducerjob.setReducerClass(Reducer.class);job.setOutputKeyClass(LongWritable.class);job.setOutputValueClass(Text.class);//默认的输出格式job.setOutputFormatClass(TextOutputFormat.class);
0 0
- Hadoop 1.x MapReduce最小驱动配置
- Hadoop 1.x MapReduce 默认驱动配置
- 最小的MapReduce驱动
- Hadoop 1.x MapReduce 模板类
- Hadoop多用户的配置(Hadoop 1.x)
- hadoop配置Mapreduce job日志
- Hadoop MapReduce 配置加载机制
- hadoop2.0.x【2】--Apache Hadoop MapReduce - Migrating from Apache Hadoop 1.x to Apache Hadoop 2--翻译与分析
- hadoop的MapReduce在java驱动代码
- Hadoop-1.x安装与配置
- hadoop 1.x 伪分布式安装配置
- hadoop 2.x 配置
- Hadoop 2.x环境搭建之三配置部署启动YARN及在YARN上运行MapReduce程序
- hadoop参数配置(mapreduce数据流)
- eclipse配置hadoop mapreduce开发环境
- MapReduce(一): Hadoop的简单配置运行
- hadoop的mapreduce配置理解一
- Hadoop:MapReduce作业配置与提交
- 智能指针C++
- 排序算法---希尔排序
- iOS学习笔记-----KVC,KVO与通知初探
- [堆 思路题] BZOJ 4524 [Cqoi2016]伪光滑数
- [leetcode] 19. Remove Nth Node From End of List
- Hadoop 1.x MapReduce最小驱动配置
- java4月18数组
- 吴恩达机器学习笔记_第四周
- HADOOP 分布模式
- Intent传值用法
- MATLAB 3
- 二叉树的创建和遍历方法(下)
- 实现圆形头像的几种方法
- push_back()函数和push()函数不要混淆