Java MapReduce

You can compile and run a MapReduce program written in Java on our Hadoop cluster. Below is an example of how to do so. You can get the file from HDFS:

hdfs dfs -get /var/examples/


Then run the following:

javac -cp `hadoop classpath`
jar cf wc.jar WordCount*.class
hadoop jar wc.jar WordCount \
/var/examples/romeojuliet.txt /user/<your_uniqname>/wc-output


To view the output:

hdfs dfs -cat /user/<your_uniqname>/wc-output/part-r-00000

Leave a Reply

Next Post