0

I am using distributed cache in my mapreduce program and I am passing three variables to this mapreduce program input file, output dir and config file.

I want to add the third argument i.e config file to the Distributed Cache.

I am setting the parameter as follows in run() method of the MapReduce Driver:-

conf.set("CONF_XML", args[2]);

How to add this file into distributed cache in the same method. how do I do that ?

Usually we add using URI(new (file path));

DistributedCache.addCacheFile(new URI(file_path), conf); << here how to pass the argument parameter? 
Ashrith
  • 6,745
  • 2
  • 29
  • 36
priyanka
  • 305
  • 1
  • 3
  • 18
  • Use of `DistributedCache.addCacheFile` is deprecated take a look at this [question](http://stackoverflow.com/questions/21239722/hadoop-distributedcache-is-deprecated-what-is-the-preferred-api) for usage on the new API `job.addCacheFile()`. – Ashrith Nov 05 '14 at 07:10

1 Answers1

2

Pass the file path argument to the DistributedCache API as URI

DistributedCache.addCacheFile(new Path(args[2]).toUri(),job.getConfiguration());

Vijay Innamuri
  • 4,242
  • 7
  • 42
  • 67