Steps to create a java program for map reduce
- Open eclipse
- Create java project
- Add package
- Add .java files(drive, mapper, reducer, combiner, partitioner, etc)
- Open project properties
- Add External jars/libs
- HadoopHome/common/
- HadoopHome/common/lib
- HadoopHome/hdfs
- HadoopHome/mapreduce
- Complile
- Export jar
How to run ?
Create input directory
$hdfs dfs -mkdir /input
Add files in input directory from local file system
$hdfs dfs -put input.txt /input
or
Create there
$hdfs dfs -touch /input/input.txt
To run use following command
$yarn your_mapreduce_project.jar <packagename>.<classname> /input /output
Check output
$hdfs dfs -ls /output
$hdfs dfs -cat /output/part-r-0000
No comments:
Post a Comment