gpt4 book ai didi

java - Reducer Hadoop 中的分布式缓存

转载 作者:可可西里 更新时间:2023-11-01 15:41:15 24 4
gpt4 key购买 nike

我想在 reducer1 的内存中保存文件 A,在 reducer2 的内存中保存文件 B。在hadoop中使用分布式缓存技术可能吗?或者,还有其他方法可以实现吗?

谢谢

最佳答案

是的,如果文件相当小,您可以将这些文件设置在分布式缓存中。点击此链接 http://developer.yahoo.com/hadoop/tutorial/module5.html#auxdata .它可能对你有用。

如果您考虑这部分代码,则由您决定要在哪个 reducer 中处理哪个文件。

Path [] cacheFiles = DistributedCache.getLocalCacheFiles(conf);
if (null != cacheFiles && cacheFiles.length > 0) {
for (Path cachePath : cacheFiles) {
if (cachePath.getName().equals(stopwordCacheName)) {
loadStopWords(cachePath);
break;
}
}

看看有没有帮助

关于java - Reducer Hadoop 中的分布式缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12555352/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com