【问题标题】:MapReduce Distributed CacheMapReduce 分布式缓存
【发布时间】:2011-03-11 00:52:20
【问题描述】:

我正在使用

将文件添加到 Hadoop 的分布式缓存中
     Configuration cng=new Configuration();
     JobConf conf = new JobConf(cng, Driver.class);
     DistributedCache.addCacheFile(new Path("DCache/Orders.txt").toUri(), cng);

其中 DCache/Orders.txt 是 HDFS 中的文件。

当我尝试使用映射器的配置方法从缓存中检索此文件时:

    Path[] cacheFiles=DistributedCache.getLocalCacheFiles(conf);

我得到空指针。可能是什么错误?

谢谢

【问题讨论】:

  • 我知道问题是由于路径。如何在 addCacheFile 中指定路径或 URI?是绝对路径吗。如果我想用URI的形式表示,应该怎么写?
  • 我在 windows 上使用单节点集群。

标签: caching distributed mapreduce


【解决方案1】:

DistributedCache 在单节点模式下不起作用,它只是返回一个空指针。或者至少这是我对当前版本的体验。

我认为 url 应该以 hdfs 标识符开头。

http://hadoop.apache.org/common/docs/current/mapred_tutorial.html#DistributedCache

【讨论】:

  • 应该是不带的,所以 /user/folder/file 而不是 hdfs://user/folder/file
猜你喜欢
  • 2012-03-15
  • 1970-01-01
  • 1970-01-01
  • 2014-10-26
  • 1970-01-01
  • 1970-01-01
  • 2014-02-23
  • 2014-08-05
相关资源
最近更新 更多