【问题标题】:Change Hadoop MapReduce local resource visibility to PUBLIC将 Hadoop MapReduce 本地资源可见性更改为 PUBLIC
【发布时间】:2015-10-15 16:23:18
【问题描述】:

有没有办法设置 hadoop 通用选项 -files 或 -archives 提供的 hadoop mapreduce 本地资源的 YARN 可见性。查看 yarn-site.xml 我发现使用 -archives 选项将文件写入工作节点的位置,但基于我读过的其他文章和它所在的目录(/hadoop/yarn/local/usercache/myusername /appcache),它被视为私有的。我找不到任何通用选项或 -D some.yarn.setting 将其从私有更改为应用程序,或者更好的是,公共的。

【问题讨论】:

  • 你的问题不清楚。 “从私有变为公共”是什么意思?
  • 我在 Hadoop 源代码中四处寻找,发现字符串“mapreduce.job.cache.archives.visibilities”可以设置为逗号分隔列表(显然每个 -archives 条目一个),但是在驱动程序配置中设置似乎没有帮助。
  • 如果您查看this Hortonworks link,您会发现可以将与 map reduce 作业捆绑在一起的文件和档案的本地资源可见性从私有(默认)更改为公共,并且公共可见性将允许在应用程序运行之间保留的文件。用户每次运行应用程序后,私有资源都会被删除。
  • 我尝试在命令行和 config.set("mapreduce.job.cache.archives.visibilities", " true,true") 无济于事。 2 个缓存的档案仍然出现在 hadoop/yarn/usercache/username/filecache/ 中,我将其解释为它仍然是私有可见性而不是公开的。

标签: hadoop mapreduce visibility hadoop-yarn


【解决方案1】:

我浏览了 Hadoop 代码。这些参数(ma​​preduce.job.cache.files.visibilitiesma​​preduce.job.cache.archives.visibilities)不能通过配置设置。

这些参数在MRJobConfig.java中定义:

  public static final String CACHE_FILE_VISIBILITIES = "mapreduce.job.cache.files.visibilities";

  public static final String CACHE_ARCHIVES_VISIBILITIES = "mapreduce.job.cache.archives.visibilities";

org.apache.hadoop.mapreduce.JobResourceUploader.java,有一个函数uploadFiles()。此函数将临时文件、jar 和存档上传到分布式缓存:

此函数通过调用以下函数确定文件和档案的可见性:

// set the public/private visibility of the archives and files
ClientDistributedCacheManager.determineTimestampsAndCacheVisibilities(conf);

上述函数调用,最终命中org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.java中的determineCacheVisibilities()函数

根据这个函数的描述:

/**
   * Determines the visibilities of the distributed cache files and 
   * archives. The visibility of a cache path is "public" if the leaf component
   * has READ permissions for others, and the parent subdirs have 
   * EXECUTE permissions for others
   * @param job
   * @throws IOException
   */
  public static void determineCacheVisibilities(Configuration job,

所以可见性是根据叶子文件和父目录的权限来确定的。

ClientDistributedCacheManager.java中,isPublic()方法有计算可见度的逻辑:

//the leaf level file should be readable by others
if (!checkPermissionOfOther(fs, current, FsAction.READ, statCache)) {
  return false;
}
return ancestorsHaveExecutePermissions(fs, current.getParent(), statCache);

最后确定权限后,在以下函数中设置可见性:

  static void setArchiveVisibilities(Configuration conf, String booleans) {
    conf.set(MRJobConfig.CACHE_ARCHIVES_VISIBILITIES, booleans);
  }

  static void setFileVisibilities(Configuration conf, String booleans) {
    conf.set(MRJobConfig.CACHE_FILE_VISIBILITIES, booleans);
  }

所以,即使你在命令行中指定了这些配置,也不会考虑配置参数。这些配置由框架本身以编程方式设置。

另外,我检查了 mapred-default.xml。可见性没有默认配置参数。

【讨论】:

  • 你摇滚。我在发布后发现了 2 个常量,但没有看到任何明显的方向可以进行调查。有趣的是,我上面的 cmets 中的 Hortonworks 链接模糊地提到了文件的权限,但没有像你所做的那样拼写任何内容。干得好!
猜你喜欢
  • 1970-01-01
  • 2013-06-01
  • 1970-01-01
  • 1970-01-01
  • 2016-06-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多