我的地图任务需要一些配置数据,我想通过分布式缓存分发这些数据。
Hadoop MapReduce Tutorial 展示了DistributedCache类的 用法,大致如下:
// In the driver
JobConf conf = new JobConf(getConf(), WordCount.class);
...
DistributedCache.addCacheFile(new Path(filename).toUri(), conf);
// In the mapper
Path[] myCacheFiles = DistributedCache.getLocalCacheFiles(job);
...
但是, DistributedCache
在 Hadoop 2.2.0 中被 标记为已弃用。
实现这一目标的新首选方法是什么?是否有涵盖此 API 的最新示例或教程?
原文由 DNA 发布,翻译遵循 CC BY-SA 4.0 许可协议
分布式缓存的 API 可以在 Job 类本身中找到。在此处查看文档:http: //hadoop.apache.org/docs/stable2/api/org/apache/hadoop/mapreduce/Job.html 代码应该类似于
在您的映射器代码中: