-
Recent Posts
Popular Posts
- Rent or Own: Amazon EC2 vs. Colocation Comparison for Hadoop Clusters 27 comment(s) | 10749 view(s)
- Mysql Replication Adapter 26 comment(s) | 6581 view(s)
- Making sure Ruby Daemons die 20 comment(s) | 7294 view(s)
- Matching Impedance: When to use HBase 19 comment(s) | 22107 view(s)
- Goodbye MapReduce, Hello Cascading 17 comment(s) | 9598 view(s)
- Rapleaf Challenge Problem 12 comment(s) | 3752 view(s)
- BloomFilter 11 comment(s) | 5382 view(s)
- Using random numbers in Hadoop MapReduce is dangerous 11 comment(s) | 3994 view(s)
- Ruby and HBase 10 comment(s) | 5204 view(s)
- Cycles of Doom in Batch Processing Workflows 10 comment(s) | 2629 view(s)
Categories
- Anonymouse (1)
- Apache (1)
- bash (1)
- Cascading (6)
- Daemons (1)
- encryption (1)
- Extensions (2)
- Google (1)
- Grub (1)
- Hadoop (22)
- HBase (6)
- HDFS (4)
- Kickstart (1)
- MapReduce (9)
- mcrypt (1)
- Miscellaneous (26)
- Mongrel (2)
- Mysql (2)
- OpenSocial (1)
- Operations (1)
- Ruby (7)
- Security (2)
- Thrift (6)
- Xen (1)
Archives
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- March 2009
- February 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007

Dead Simple MapReduce Workflow Configuration
If you use MapReduce for any real-world application, chances are your workflow consists of more than one MapReduce job. Rapleaf has workflows consisting of over one hundred jobs. A lot of times, you need to make configurations to the workflow that should apply to every job. For example, you may want each job to run in the same fair scheduler pool or use a certain number of reducers.
One way to do this would be to configure each job at the code level. Unfortunately, this can be tedious and error-prone, since if you add a new job to the workflow you need to remember to add the proper configurations. Fortunately, there’s a better way.
Hadoop has a static method called “Configuration.addDefaultResource” that allows you to specify a file to be loaded into the configuration by default. Like Cascading Style Sheets, Hadoop will load the configurations one file at a time, with configurations from later files overriding those from earlier ones. A static initializer in the JobConf class causes Hadoop to load in “mapred-default.xml” and “mapred-site.xml”.
To create an application level configuration, you will want to perform the following steps:
1. Create an “application-site.xml” file and put it in the same directory from which you run your job jar.
2. In the main method of your code, add the lines:
Configuration.addDefaultResource("application-site.xml");
3. Ensure that “.” is in your classpath when you run the job jar so that Hadoop can find the “application-site.xml” resource.
A side benefit of this approach is that if you need to tweak some settings in the middle of a workflow, you just need to edit the application-site.xml file and each subsequent job will pick up the new settings.