nativeInstallerhadoop

Run a test job in Hadoop

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

You can run jobs in Hadoop from the same computer where it is installed.

Hadoop bundles many examples that you can try. For instance, there is an example for obtaining an estimation of the Pi number’s value. You can check it by running the following command:

$ hadoop jar installdir/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-*.jar pi 10 100

When the job finishes, you will see an output similar to:

Estimated value of Pi is 3.14800000000000000000

In order to show a MapReduce example involving HDFS, you can try running the following commands for showing how many words begin with the letter “c” in a simple tongue twister:

$ echo "can you can a can as a canner can can a can" | hadoop fs -put - /tmp/hdfs-example-input
$ hadoop jar installdir/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-*.jar grep /tmp/hdfs-example-input /tmp/hdfs-example-output 'c[a-z]+'
$ hadoop fs -cat /tmp/hdfs-example-output/part-r-00000

You will see the job resulted in the following output:

6       can
1       canner
Last modification April 8, 2020