菜单
菜单
文章目录
  1. 1.创建本地文件
  2. 2.创建输入文件夹
  3. 3.上传本地文件
  4. 4.运行WordCount
  5. 5.查看结果

Hadoop学习(二):运行WordCount

1.创建本地文件

mdkir file
cd file
echo "hello world">file1.txt
echo "hello hadoop">file2.txt

2.创建输入文件夹

hadoop fs -mkdir /input

3.上传本地文件

hadoop fs -put ./file/file*.txt /input

4.运行WordCount

hadoop jar ./libexec/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar wordcount /input /output

5.查看结果

hadoop fs -cat /output/part-r-00000
hadoop	1
hello 2
world 1