Hadoop下运行WordCount的命令总结(亲身体验)

$ bin/hadoop namenode -format
$ bin/start-all.sh

$ mkdir wordcount_classes
$ javac -classpath ${HADOOP_HOME}/hadoop-${HADOOP_VERSION}-core.jar -d wordcount_classes WordCount.java
$ jar -cvf /usr/joe/wordcount.jar -C wordcount_classes/ .

$ bin/hadoop fs -put inputfile/* /user/panbook/input
$ bin/hadoop jar /usr/joe/wordcount.jar org.myorg.WordCount inputfile /user/panbook/output

$ bin/hadoop dfs -cat /usr/joe/wordcount/output/part-00000
或者
$ bin/hadoop fs -cat output/*
或者
$ bin/hadoop fs -get output output
$ cat output/*

$ bin/stop-all.sh

你可能感兴趣的:(Hadoop下运行WordCount的命令总结(亲身体验))