cdh3u3 hadoop 0.20.2 MultipleOutputs多输出文件怎么实现
发表于:2024-09-21 作者:千家信息网编辑
千家信息网最后更新 2024年09月21日,本篇内容介绍了"cdh3u3 hadoop 0.20.2 MultipleOutputs多输出文件怎么实现"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下
千家信息网最后更新 2024年09月21日cdh3u3 hadoop 0.20.2 MultipleOutputs多输出文件怎么实现
本篇内容介绍了"cdh3u3 hadoop 0.20.2 MultipleOutputs多输出文件怎么实现"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
1.新建一个multest.txt文件
11111,username,password,22,河北师范大学,软件学院,200811112,username,password,22,河北师范大学,计算机学院,200811113,username,password,22,xx大学,软件学院,200811114,username,password,22,xxx大学,计算机学院,200811115,username,password,23,2008
2.在hdfs上新建一个目录,hadoop dfs -mkdir multest
3.将新建到文本文件上传到multest目录下:hadoop dfs -put /home/wjk/hadoop/multest.txt multest
4.新建Map/Reduce工程,将格式不符合(7位)到保存到dirtydata中,将河北师范大学软件学院以外到数据保存到otherschool中,将河北师范大学软件学院到数据保存到默认文件中。
public class Multest { public static class MultestMapper extends Mapper
5.编译,导出jar,运行:hadoop jar ./../multest.jar com.wjk.test.Multest multest multestout
6.运行截图
=======注意==========================
缺陷:集群上运行会有多个分散的文件
补充:按上述的写法产生的文件很多,合并很难,可以执行输出目录,合并的话按目录getmerge就容易了。主要修改点在mos.write上,参考官方代码,很简单,自行领悟吧。
publicvoid write(String namedOutput, K key, V value) throws IOException, InterruptedException { write(namedOutput, key, value, namedOutput);}public void write(String namedOutput, K key, V value,String baseOutputPath) throws IOException, InterruptedException { checkNamedOutputName(this.context, namedOutput, false); checkBaseOutputPath(baseOutputPath); if (!(this.namedOutputs.contains(namedOutput))) { throw new IllegalArgumentException("Undefined named output '" + namedOutput + "'"); } TaskAttemptContext taskContext = getContext(namedOutput); getRecordWriter(taskContext, baseOutputPath).write(key, value);}
"cdh3u3 hadoop 0.20.2 MultipleOutputs多输出文件怎么实现"的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!
文件
大学
学院
师范
软件
软件学院
河北
河北师范大学
输出
目录
内容
数据
更多
知识
计算机
运行
实用
学有所成
接下来
代码
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
无线网络安全技术姚琳下载
网络安全等级保护定级模板
002115网络安全
网站备案要本地服务器吗
网络安全王营康
菏泽智慧团建软件开发系统
吉林网络安全培训
部队网络安全教育内容
网络技术就业好吗
现代语言学被什么数据库收录
实名认证显示连接服务器失败
数据库查询值有问号
网络技术研发的英文缩写
湖南分析软件开发商
云轩服务器
建立空数据库和模板数据库
什么叫v型软件开发
我国网络安全工作的轮廓是
湖南现代软件开发直销价格
sql数据库中视图的作用
net项目的数据库
计算机网络技术怎么复习
故城软件开发专业
神武2服务器开放时间
win10配置域名映射到服务器
开展网络安全宣传的目的
淄博 服务器
sso数据库
ftp测试服务器
数据库基础及应用作业