August 2015
Beginner to intermediate
294 pages
5h 20m
English
Hadoop can be downloaded and installed from https://hadoop.apache.org/. We'll be using the Hadoop streaming API to execute our Python MapReduce program in Hadoop. The Hadoop Streaming API helps in using any program that has a standard input and output as a MapReduce program.
We'll be writing three MapReduce programs using Python, they are as follows:
We'll start with the word count MapReduce. Save the following code in a word_mapper.py file:
import sys for l in sys.stdin: # Trailing and Leading white space is removed l = l.strip() # words in the line is split word_tokens = l.split() # Key Value ...
Read now
Unlock full access