This is an old revision of the document!
MapReduce Tutorial : Making your job configurable
Sometimes it is desirable for a Hadoop job to be configurable without recompiling/rewriting the source. This can be achieved:
- both Perl and Java: use environment variables – all environment variables are shared by the Hadoop job
- Java only: use Hadoop properties:
- when running the job, use
/net/projects/hadoop/bin/hadoop job.jar -Dname1=value1 -Dname2=value2 … input output
- in the job, use
job.getConfiguration.get(“name”, default)
to get thevalue
asString
, or use one ofgetInt, getLong, getFloat, getRange, getFile, getStrings, …