【问题标题】:passing URI as a runtime variable to distributed cache in mapreduce hadoop将URI作为运行时变量传递给mapreduce hadoop中的分布式缓存
【发布时间】:2015-01-01 06:50:28
【问题描述】:

我在我的 mapreduce 程序中使用分布式缓存,我将三个变量传递给这个 mapreduce 程序 input file、output dir 和 config file。

我想将第三个参数,即配置文件添加到分布式缓存。

我在MapReduce Driver的run()方法中设置参数如下:-

conf.set("CONF_XML", args[2]);

如何以相同的方法将此文件添加到分布式缓存中。我该怎么做?

通常我们使用URI(new (file path));添加

DistributedCache.addCacheFile(new URI(file_path), conf); << here how to pass the argument parameter? 

【问题讨论】:

  • 不推荐使用DistributedCache.addCacheFile,请查看此question 以了解在新API job.addCacheFile() 上的使用情况。

标签: caching hadoop mapreduce distributed


【解决方案1】:

将文件路径参数作为 URI 传递给 DistributedCache API

DistributedCache.addCacheFile(new Path(args[2]).toUri(),job.getConfiguration());

【讨论】:

    猜你喜欢
    • 2011-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多