Writing Map Reduce results to multiple output files

In this recipe, we are going to learn how to write a map reduce output to multiple output files. This will be useful when we need to use classified output for different purposes.

Getting ready

To perform this recipe, you should have a running Hadoop cluster as well as an eclipse similar to an IDE.

How to do it...

Hadoop supports a class called MultipleOutputs, which allows us to write out of a map reduce program to multiple files. We can write output to different files, file types, and different locations with it. You can also choose the filename with this API. To use this, we will take a look at a simple word count program and write out of this program to multiple output files.

To do so, we need ...

Get Hadoop Real-World Solutions Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.