What is the preferred way to pass a small number of configuration parameters to a mapper or
As key-value pairs in the jobconf object.
As a custom input key-value pair passed to each mapper or reducer.
Using a plain text file via the Distributedcache, which each mapper or reducer reads.
Through a static variable in the MapReduce driver class (i.e., the class that submits the
In Hadoop, it is sometimes difficult to pass arguments to mappers and reducers. If
the number of arguments is huge (e.g., big arrays), DistributedCache might be a good choice.
However, here, we’re discussing small arguments, usually a hand of configuration parameters.
In fact, the way to configure these parameters is simple. When you initialize“JobConf”object to
launch a mapreduce job, you can set the parameter by using“set”method like:
1JobConf job = (JobConf)getConf();
Here,“NumberOfDocuments”is the name of parameter and its value is read from“args“, a
command line argument.
Reference:Passing Parameters and Arguments to Mapper and Reducer in Hadoop