How to Run Hadoop wordcount MapReduce Example on Windows 10

Muhammad Bilal Yar edited this page Jul 20, 2017 · 2 revisions

Prepare

  1. Download MapReduceClient.jar (Link: https://github.com/MuhammadBilalYar/HADOOP-INSTALLATION-ON-WINDOW-10/blob/master/MapReduceClient.jar)
  2. Download Input_file.txt (Link: https://github.com/MuhammadBilalYar/HADOOP-INSTALLATION-ON-WINDOW-10/blob/master/input_file.txt)

Place both files in "C:/"

Hadoop Operation

  1. Open cmd in Administrative mode and move to "C:/Hadoop-2.8.0/sbin" and start cluster
Start-all.cmd

start all

  1. Create an input directory in HDFS.
hadoop fs -mkdir /input_dir
  1. Copy the input text file named input_file.txt in the input directory (input_dir)of HDFS.
hadoop fs -put C:/input_file.txt /input_dir
  1. Verify input_file.txt available in HDFS input directory (input_dir).
hadoop fs -ls /input_dir/

Input_file

  1. Verify content of the copied file.
hadoop dfs -cat /input_dir/input_file.txt

Content

  1. Run MapReduceClient.jar and also provide input and out directories.
hadoop jar C:/MapReduceClient.jar wordcount /input_dir /output_dir

Success

  1. Verify content for generated output file.
hadoop dfs -cat /output_dir/*

out

Some Other usefull commands

To leave Safe mode

hadoop dfsadmin –safemode leave

To Delete file from HDFS directory

hadoop fs -rm -r /iutput_dir/input_file.txt

To Delete directory from HDFS directory

hadoop fs -rm -r /iutput_dir

comm

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.