运行WordCount
1、在目录/tmp/目录下创建file1.txt、file2.txt
file1.txt输入内容
hello hadoop hi china
hello hadoop hi shanxi
file2.txt输入内容
hello world hi hadoop
2、启动HDFS后创建HDFS目录/input2:
hadoop fs -mkdir /input2
3、将file1.txt、file2.txt保存到HDFS中:
hadoop fs -put /tmp/file*.txt /input2
4、查看HDFS上是否已经存在file1.txt、file2.txt:
hadoop fs -ls /input2
表示HDFS保存文件成功
5、运行"hadoop jar XXX.jar"执行WordCount程序
hadoop jar /usr/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.2.0.jar wordcount /input2/ /output2/wordcount1
6、查看输出结果
hadoop fs -cat /output2/wordcount1/*