1 | JarFile="sample-0.1.jar" |
---|
2 | MainFunc="Sample.WordCount" |
---|
3 | LocalOutDir="/tmp/output" |
---|
4 | HADOOP_BIN="/opt/hadoop/bin" |
---|
5 | |
---|
6 | all:jar run output clean |
---|
7 | |
---|
8 | jar: |
---|
9 | jar -cvf ${JarFile} -C bin/ . |
---|
10 | |
---|
11 | run: |
---|
12 | ${HADOOP_BIN}/hadoop jar ${JarFile} ${MainFunc} input output |
---|
13 | |
---|
14 | clean: |
---|
15 | ${HADOOP_BIN}/hadoop fs -rmr output |
---|
16 | |
---|
17 | output: |
---|
18 | rm -rf ${LocalOutDir} |
---|
19 | ${HADOOP_BIN}/hadoop fs -get output ${LocalOutDir} |
---|
20 | gedit ${LocalOutDir}/part-r-00000 & |
---|
21 | |
---|
22 | help: |
---|
23 | @echo "Usage:" |
---|
24 | @echo " make jar - Build Jar File." |
---|
25 | @echo " make clean - Clean up Output directory on HDFS." |
---|
26 | @echo " make run - Run your MapReduce code on Hadoop." |
---|
27 | @echo " make output - Download and show output file" |
---|
28 | @echo " make help - Show Makefile options." |
---|
29 | @echo " " |
---|
30 | @echo "Example:" |
---|
31 | @echo " make jar; make run; make output; make clean" |
---|
32 | |
---|