Hadoop comes packaged with a number of example applications. We are of course interested in calculating П program in particular.
The source code for this application can be downloaded from Apache's website at the following URL:
The JAR file containing the compiled class can be found on your machine at:
/home/pi/hadoop/hadoop-1.2.1/hadoop-examples-1.2.1.jar
Let's navigate to this directory:
cd ~/hadoop/hadoop-1.2.1
We are now going to run the example. The program takes two inputs: the number of maps and the number of samples. Try running the following demonstration:
hadoop jar hadoop-examples-1.2.1.jar pi 2 4
You should now see something similar to:
Number of Maps = 2 Samples per Map = 4 Wrote input for Map #0 Wrote input for Map #1 Starting Job … Job Finished in 273.167 seconds Estimated value...