wordcount类
在hadoop-1.1.2/hadoop-examples-1.1.2.jar中
- 命令
mkdir input
..
vim /input/test
//文件中内容:
/**
* hello hadoop
* fine fine hello
**/
hadoop fs -mkdir -p /class/input
hadoop fs -put test /class/input/
hadoop jar hadoop-examples-1.1.2.jar wordcount hdfs://hadoop:9000/class/input/text hdfs://hadoop:9000/class/input/out11
//查看结果
hadoop fs -cat /class/input/out11/part-r-00000
- wordcount大概过程:
- word : < hello 1>
< hadoop 1>
< fine 1>
< find 1>
< hello 1> - < hello 1>
< hello 1>
< hadoop 1>
< fine 1>
< find 1> - < hello 1 1>
< hadoop 1>
< fine 1 1> - < hello 2>
< hadoop 1>
< fine 2>