How to Run Hadoop wordcount MapReduce on Windows 10
2017, Jul 20
How to Run Hadoop wordcount MapReduce on Windows 10
Prepare
-
Download MapReduceClient.jar (Link: https://github.com/MuhammadBilalYar/HADOOP-INSTALLATION-ON-WINDOW-10/blob/master/MapReduceClient.jar)
-
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
- Open cmd in Administrative mode and move to “C:/Hadoop-2.8.0/sbin” and start cluster
Start-all.cmd
- Create an input directory in HDFS.
hadoop fs -mkdir /input_dir
- 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
- Verify input_file.txt available in HDFS input directory (input_dir).
hadoop fs -ls /input_dir/
- Verify content of the copied file.
hadoop dfs -cat /input_dir/input_file.txt
- Run MapReduceClient.jar and also provide input and out directories.
hadoop jar C:/MapReduceClient.jar wordcount /input_dir /output_dir
- Verify content for generated output file.
hadoop dfs -cat /output_dir/*
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