mapreduce分布式缓存
2013-01-07 16:05
127 查看
概述
作用
应用场景
示例
作用
将hdfs中的文件copy到本地map/reduce程序端,供map/reduce端代码使用
应用场景
大文件与小文件合并操作,如大文件10G,小文件10M,并且输入格式可以完全不一样
示例
主函数端代码
map或reduce类端
作用
应用场景
示例
作用
将hdfs中的文件copy到本地map/reduce程序端,供map/reduce端代码使用
应用场景
大文件与小文件合并操作,如大文件10G,小文件10M,并且输入格式可以完全不一样
示例
主函数端代码
public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf); job.getConfiguration().set("xyz", "fileHdfsLocation"); }
map或reduce类端
public static class LogMapper extends Mapper<Object, LongWritable, xxx, xxx> { private static HashSet<String> smallCollection = null; protected void setup(Context context) throws IOException, InterruptedException { smallCollection = new HashSet<String>(); Path fileIn = new Path(context.getConfiguration().get("xyz")); FileSystem hdfs = fileIn.getFileSystem(context.getConfiguration()); FSDataInputStream hdfsReader = hdfs.open(fileIn); Text line = new Text(); LineReader lineReader = new LineReader(hdfsReader); while (lineReader.readLine(line) > 0) { //you can do something here System.out.println(line.toString()); smallCollection.add(line.toString()); } lineReader.close(); hdfsReader.close(); } public void map(Object key, Text value, Context context) throws IOException, InterruptedException { // use this Hashset } }
相关文章推荐
- MapReduce分布式缓存程序,无法在Windows下的Eclipse中执行问题解决
- 在mapreduce中做分布式缓存的问题
- MapReduce 分布式计算框架详细介绍
- 分布式系统漫谈一 —— Google三驾马车: GFS,mapreduce,Bigtable
- SXT分布式缓存技术公开课的观后感
- 分布式缓存系统Memcached简介与实践
- 分布式缓存MemcacheHelper
- 巧妙设计多级缓存,为数据库减负 - 分布式
- 分布式缓存架构Memcached简介与实践
- 分布式缓存Redis扫盲教程
- 使用微软分布式缓存服务Velocity Part 1
- 分布式缓存的一致性Hash的Java实现
- 基于HBase Hadoop 分布式集群环境下的MapReduce程序开发
- 分布式缓存系统Memcached学习心得
- 大型网站架构系列:缓存在分布式系统中的应用(一)
- 分布式缓存系统 Memcached 半同步/半异步模式
- 分布式缓存:memcached(监控状态、缓存扩展)
- 使用微软分布式缓存服务Velocity Part 1
- 配置Memcache作为Hibernate的二级分布式缓存
- 分布式缓存--memcached