随笔分类 -  Hadoop Sample

Sample SecondarySort 浅析
摘要:示例文件:100 99 100 98 100 56 100 78 20 100 30 100 20 50 30 50 30 60 20 80 需求:首先按第一个数字分组,组成按第二个数字排序。解决方案: ... 阅读全文

posted @ 2015-02-26 21:23 tneduts 阅读(362) 评论(0) 推荐(0)

Sample Join Analysis
摘要:Sample data: student.txt 1,yaoshuya,25 2,yaoxiaohua,29 3,yaoyuanyie,15 4,yaoshupei,26 Sample data:score.txt 1,yuwen,100 1,shuxue,99 2,yuwen,99 2,shuxue,88 ... 阅读全文

posted @ 2015-02-23 16:36 tneduts 阅读(362) 评论(0) 推荐(0)

Sample MultipleFileWordcount CombineFileInputFormat
摘要:在旧版本的samples中,使用的是旧的api,mapred下面的MultiFileInputFormat,现在已经过时。现在推荐使用mapreduce下面的CombineInputFormat来处理。应用场景: 如果文件数量大,而且单个文件又比较小,若是使用FileInputFormat进行分片... 阅读全文

posted @ 2015-02-23 09:25 tneduts 阅读(405) 评论(0) 推荐(0)

FileOutputFormat
摘要:TextOutputFormat 默认输出字符串输出格式;SequenceFileOutputFormat 序列化文件输出;MultipleOutputs 可以把输出数据输送到不同的目录;下面我们以分析FileOutputFormat为例,得到一些启迪,来满足我们的某些需要,如修改keyvalue的... 阅读全文

posted @ 2015-02-22 21:30 tneduts 阅读(510) 评论(0) 推荐(0)

Combine small files to Sequence file
摘要:Combine small files to sequence file or avro files are a good method to feed hadoop. Small files in hadoop will take more namenode memory resource. SequenceFileInputFormat 是一种Key value 格式的文件格式。 Key... 阅读全文

posted @ 2015-02-22 11:05 tneduts 阅读(386) 评论(0) 推荐(0)

FileInputFormat
摘要:MapReduce框架要处理数据的文件类型 FileInputFormat这个类决定。 TextInputFormat是框架默认的文件类型,可以处理Text文件类型,如果你要处理的文件类型不是Text, 譬如说是Xml或DB,你就需要自己实现或用库中已有的类型。 FileInputFormat的主要方法之一getSplits完成的功能是获取job要处理的路径文件所在的block信息。 数据... 阅读全文

posted @ 2015-02-21 20:59 tneduts 阅读(376) 评论(0) 推荐(0)

Sample: Write And Read data from HDFS with java API
摘要:HDFS: hadoop distributed file system 它抽象了整个集群的存储资源,可以存放大文件。 文件采用分块存储复制的设计。块的默认大小是64M。 流式数据访问,一次写入(现支持append),多次读取。 不适合的方面: 低延迟的数据访问 解决方案:HBASE 大量的小文件 解决方案:combinefileinputformat... 阅读全文

posted @ 2015-02-21 14:10 tneduts 阅读(549) 评论(0) 推荐(0)

WordCount Analysis
摘要:1.Create a new java project, then copy examples folder from /home/hadoop/hadoop-1.0.4/src; Create a new folder named src, then Paste to the project to this folder. Error: Could not find or load main... 阅读全文

posted @ 2015-02-19 00:30 tneduts 阅读(371) 评论(0) 推荐(0)

导航