How to Run Hadoop wordcount MapReduce on Windows 10

How to Run Hadoop wordcount MapReduce on Windows 10

2017, Jul 20    

How to Run Hadoop wordcount MapReduce on Windows 10

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

DONE :)