1.  启动集群

2.  创建input路径(有关hadoop 的命令用 "hadoop fs",input路径并不能在系统中查找到,可以使用 “hadoop fs -ls /”

hadoop fs -mkdir /input

3.  创建测试文件(test1.txt,test2.txt)

test1.txt

Hello World Bye World

test2.txt

Hello Hadoop Goodbye Hadoop

4.  将测试文件放入/input 中

hadoop fs -put test* /input

5.  测试(hadoop-mapreduce-examples-2.7.7.jar 是hadoop中的文件,根据自己的路径编写)

hadoop jar /home/komean/workspace/hadoop/hadoop-2.7.7/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.7.jar wordcount  /input /output

MapReduce计算之——hadoop中的Hello World

6.  查看结果

hadoop fs -cat /output/part-r-00000

MapReduce计算之——hadoop中的Hello World

 

相关文章:

  • 2021-10-09
  • 2021-08-13
  • 2021-12-19
  • 2021-12-11
  • 2021-06-06
  • 2021-05-24
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2021-09-09
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
相关资源
相似解决方案