hadoop学习(7)—— 使用yarn运行mapreduce一个简单的wordcount示例
发布日期:2021-10-04 02:53:36 浏览次数:6 分类:技术文章

本文共 1006 字,大约阅读时间需要 3 分钟。

1.hdfs文件系统目录要求(建议)

/user        /{username}             --用户名            /mr                 --MapReduce类型应用                /wordcount      --应用的名称                    /input      --要处理的文件                    /output     --输出结果的文件夹

2.按照目录格式创建输入文件夹(不用创建输出文件夹)

[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -mkdir -p /user/root/mr/wordcount/input

3.手动创建测试数据

cyhp supergroup    hadoop hello    hdfs hadoop    mapreduce hadoop    world yarn

4.将输入数据放入HDFS中

[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -put test-datas/wc.input  /user/root/mr/wordcount/input/

5.使用yarn运行示例

[root@hadoop-yarn hadoop-2.6.5]# bin/yarn jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.5.jar wordcount /user/root/mr/wordcount/input/ /user/root/mr/wordcount/output/

6.查看输出

[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -text /user/root/mr/wordcount/output/par*
[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -text /user/root/mr/wordcount/output/par*cyhp    1hadoop  3hdfs    1hello   1mapreduce   1supergroup  1world   1yarn    1

转载地址:https://blog.csdn.net/leifeng_001/article/details/70184569 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:HBase学习(1)—— 环境搭建
下一篇:hadoop学习(6)—— 启动yarn

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2024年03月29日 13时25分54秒