作业六:Hadoop使用实例

词频统计

    1.下载喜欢的电子书或大量文本数据,并保存在本地文本文件中

    2.编写map与reduce函数

 

   3.本地测试map与reduce

   4.将文本数据上传至HDFS上

   5.用hadoop streaming提交任务

hadoop jar $STREAM  \
-file /home/hadoop/wc/mapper.py \
-mapper  /home/hadoop/wc/mapper.py \
-file /home/hadoop/wc/reducer.py \
-reducer  /home/hadoop/wc/reducer.py \
-input /user/hadoop/input/*.txt \
-output /user/hadoop/wcoutput

   6.查看运行结果

   7.计算结果取回到本地

posted @ 2020-11-06 18:12  欧克菲  阅读(155)  评论(0)    收藏  举报