2015-10-15 51 views
1

有没有一种方法来设置由Hadoop的通用选项提供一个Hadoop MapReduce的本地资源的纱线知名度-files或-archives。在yarn-site.xml中查找我使用-archives选项找到了在worker节点上写入文件的位置,但是基于我读过的其他文章和它登录的目录(/ hadoop/yarn/local/usercache/myusername/appcache)它被视为私有。我找不到任何通用选项或-D some.yarn.setting将其从私有应用程序更改为应用程序或更好,公共。变化的Hadoop MapReduce的本地资源能见度PUBLIC

+0

你的问题不清楚。 “从私人到公共”的含义是什么? –

+0

我在Hadoop的源戳周围,发现字符串“mapreduce.job.cache.archives.visibilities”,它可以被设置为逗号分隔的列表(每个-archives条目显然),但设置在驱动程序配置没有按似乎没有帮助。 –

+0

如果您看[此Hortonworks链接](http:// hortonworks。com/blog/management-of-application-dependencies-in-yarn /),您会发现可以将地图缩减作业捆绑的文件和存档的本地资源可见性从私有(默认)更改为公共和公共可见将允许文件在应用程序的运行之间持续存在。私人资源将在用户每次运行应用程序后被删除。 –

回答

1

我通过Hadoop的代码去了。这些参数(mapreduce.job.cache.files.visibilitiesmapreduce.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()。此功能上传的临时文件,罐子和档案馆分布式缓存:

这个功能决定的文件和档案的知名度,通过调用以下功能:

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

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

按本功能的描述:

/** 
    * 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.javaisPublic()方法具有计算能见度的逻辑:

//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中。可见性没有默认配置参数。

+0

你摇滚。我发布后发现了两个常量,但没有看到任何明显的方向去调查。有趣的是,我上面的评论中的Hortonworks链接隐约提到了文件的权限,但没有像你所做的那样拼写出任何内容。做得好! –