I am trying to implement distributed cache in my MapReduce program. In the main method I am adding the cache files.
Configuration conf = new Configuration();
Job job = new Job(conf, "example");
DistributedCache.addCacheFile(new URI("/user/vinay/card.txt"), conf);
/user/vinay/card.txt file exists in my hdfs.
I am referring to this file in the setup method:
public void setup(Context context) throws IOException, InterruptedException{
Configuration conf = context.getConfiguration();
Path[] cacheFiles = DistributedCache.getLocalCacheFiles(conf);
}
The cacheFiles array is always getting a null value. First, I tried running it on single node Hadoop cluster, but then I read somewhere that it prevents distributed cache working. Then I tried executing this code in pseudo-distributed mode, but then also it is not working.