Created
June 19, 2012 06:25
-
-
Save donigian/2952590 to your computer and use it in GitHub Desktop.
Writing Python MapReduce code for Hadoop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In order to develop in a language other than JAVA, we need to use HadoopStreaming to pass data between Map and Reduce code via STDIN (standard input) and STDOUT (standard output). We can use Python’s sys.stdin to read input data and print our own output to sys.stdout. That’s all we need to do because HadoopStreaming will take care of everything else! | |
Run the MapReduce job | |
hduser@ubuntu:/usr/local/hadoop$ bin/hadoop jar contrib/streaming/hadoop-*streaming*.jar -file /home/hduser/mapper.py -mapper /home/hduser/mapper.py -file /home/hduser/reducer.py -reducer /home/hduser/reducer.py -input /user/hduser/babalu/* -output /user/hduser/babalu-output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment