创建测试文件
mkdir file
cd file/
echo "Hello word" > file1.txt
echo "Hello a word" > file2.txt
创建HDFS目录
cd ~/hadoop/
sbin/start-all.sh
bin/hadoop fs -mkdir /input2
上传测试文本
cd ~/file
../hadoop/bin/hadoop fs -put file* /input2/
../hadoop/bin/hadoop fs -ls /input2/
执行WordCount
cd ~/hadoop
bin/hadoop jar share/hadoop/mapreduce/hadoop-mareduce-examples-3.2.2.jar wordcount /input2 /output2/wordcount1
bin/hadoop fs -cat /output2/wordcount1