Share a shell script executed by your own Hadoop,
But for those who write shell scripts, it's not going to work.
People who can't write shell scripts seem to be confused.
If you are interested in learning, you can contact in private. As for
The related files (source code/compile.sh) involved in the script could not be uploaded.
Make a record so that it is convenient for you to review later.
Because it is only for their own testing, it is more coarse
At the time of execution:
Direct execution procedure
Hadoop@namenode#./hadooprunaveragepower
Recompile execution
Hadoop@namenode#./hadooprunaveragepower y script files are as follows:
#!/bin/sh
#HadoopRunAveragePower isstandalone=0 #isStandalone: 0 Hadoop clust; 1 Standalone
Compilefile= "Averagepowercompile.sh"
Sourcefolder= "workspace/averagepower/"
Jarfolder= "."
Inputpath= "input2/"
Outputpath= "output/"
Jarfile= "Averagepower.jar"
Jarmainclass= "Workdir. Averagepower "
Compressornot= "true"
maptasknum=2
Reducetasknum=1
Isrebuild= "n"
If ["$#"-GT 0];then
#echo do your want to run rebuild this application[y/n]?
echo "Ready to Rebuild Source"
If ["$" = "Y"];then
Isrebuild=$1
elif ["$" = "Y"];then
Isrebuild=$1
Fi
Case "$isRebuild" in
[yy]*)
echo do:find $SOURCEFOLDER-name *.java~-exec rm-f {} \;
Find $SOURCEFOLDER-name *.java~-exec rm-f {} \;
echo do:find $SOURCEFOLDER-name *.class-exec rm-f {} \;
Find $SOURCEFOLDER-name *.class-exec rm-f {} \;
Echo DO:RM-VF $JARFILE
RM-VF $JARFILE
Echo Do:bash $COMPILEFILE
Bash $COMPILEFILE
echo DO:JAR-CVF $JARFILE-C $SOURCEFOLDER $JARFOLDER
JAR-CVF $JARFILE-C $SOURCEFOLDER $JARFOLDER
echo "Rebuild application Successfully"
;;
*)
echo "Parameter Error"
echo "Not Rebuild application"
exit;;
Esac
Else
echo "Not Rebuild application"
Fi
echo do your want to run this application[y/n]?
Read answer
Case "$answer" in
[yy]*)
If ["$isStandalone"-eq 0];then
echo Do:bin/hadoop FS-RMR $OUTPUTPATH
Bin/hadoop FS-RMR $OUTPUTPATH
Else
Echo DO:RM-RVF $OUTPUTPATH
RM-RVF $OUTPUTPATH
Fi
The echo do:bin/hadoop jar $JARFILE $JARMAINCLASS-C $COMPRESSORNOT-M $MAPTASKNUM-R $REDUCETASKNUM $INPUTPATH $OUTPUTPATH
Bin/hadoop jar $JARFILE $JARMAINCLASS-C $COMPRESSORNOT-M $MAPTASKNUM-R $REDUCETASKNUM $INPUTPATH $OUTPUTPATH
echo Input_dir: $INPUTPATH
echo Input_dir: $OUTPUTPATH
echo application Success done and exited.
;;
*) exit;;
Esac