#进入hadoop安装目录

cd /usr/local/hadoop

#创建示例文件:input

#在里面输入以下内容:

#Hello world, Bye world!

vim input

#在hdfs上创建文件路径

bin/hadoop fs -mkdir  /user/root/test/wordcount

#将输入文件拷贝到hdfs

bin/hadoop fs -put input /user/root/test/wordcount

#执行程序

bin/hadoop jar hadoop-examples-1.0.3.jar wordcount /user/root/test/wordcount /user/root/test/wordcount/output

#程序在执行完毕后查看执行结果

 bin/hadoop fs -cat /user/root/test/wordcount/output/*

#程序将会输出下面的结果(请忽略最后一句^_^):

Bye 1
Hello 1
world! 1
world, 1
cat: File does not exist: /user/root/test/wordcount/output/_logs

#至此,map/reduce执行完毕。

相关文章:

  • 2021-11-15
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2021-09-11
  • 2021-11-09
  • 2021-12-18
猜你喜欢
  • 2021-09-24
  • 2021-06-12
  • 2021-06-07
  • 2021-09-05
  • 2021-05-30
  • 2021-09-25
相关资源
相似解决方案