Hadoop DistributedCache无法访问存档

Hadoop DistributedCache无法访问存档,hadoop,Hadoop,我可以使用DistributedCache访问单个文件,但无法访问存档。 在main方法中,我将归档添加为 DistributedCache.addCacheArchive(new Path("/stocks.gz").toUri(), job.getConfiguration()); 其中/stocks.gz在hdfs中。在我使用的映射器中 Path[] paths = DistributedCache.getLocalCacheArchives(context.getConfigurati

我可以使用DistributedCache访问单个文件,但无法访问存档。 在main方法中,我将归档添加为

DistributedCache.addCacheArchive(new Path("/stocks.gz").toUri(), job.getConfiguration());
其中/stocks.gz在hdfs中。在我使用的映射器中

Path[] paths = DistributedCache.getLocalCacheArchives(context.getConfiguration());
File localFile = new File(paths[0].toString());
它抛出了一个异常

java.io.FileNotFoundException: /tmp/hadoop-user/mapred/local/taskTracker/distcache/-8696401910194823450_622739733_1347031628/localhost/stocks.gz (No such file or directory)
我希望DistributedCache解压/stocks.gz,映射器使用底层文件,但它抛出FileNotFound异常


当传递单个文件时,DistributedCache.addCacheFile和DistributedCache.getLocalCacheFiles可以正常工作,但是传递存档不起作用。我做错了什么?

你能给stocks.gz一个绝对路径吗

DistributedCache.addCacheArchive(new Path("<Absolute Path To>/stocks.gz").toUri(), job.getConfiguration());
DistributedCache.addCacheArchive(新路径(“/stocks.gz”).toUri(),job.getConfiguration());

我尝试使用hdfs://localhost:8020/stocks.gz,但它给出了同样的例外。不是那样。我指的是文件系统中文件的绝对路径。比如/home/hadoop/data/stocks.gz我不确定我是否理解。“/stocks.gz”是hdfs中文件的绝对路径。它应该是hdfs中文件的路径