大数据实验总结(六)--搭建Mapreduce(YARN)环境,运行Wordcount示例

更新时间:2023-06-22 22:30:13 阅读: 评论:0

⼤数据实验总结(六)--搭建Mapreduce(YARN)环境,运⾏Wordcount⽰例搭建Mapreduce(YARN)环境,运⾏Wordcount⽰例
搭建Mapreduce(YARN)环境
修改l⽂件:
cd /usr/local/hadoop/etc/hadoop/
l
如图:
上海到安吉
具体内容:
<!-- Site specific YARN configuration properties -->
<configuration>
<property>
<name&sourcemanager.hostname</name>
<value>master</value>
</property>
<property>
<name&demanager.aux-rvices</name>
<value>mapreduce_shuffle</value>
</property>
大至<property>
<name&demanager.aux-rvices.mapreduce_shuffle.class </name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
</configuration>
其中名称sourcemanager.hostname指的是ResourceManager机器所在的节点位置;名称demanager.aux-rvices在hadoop2.2.0版本中是mapreduce_shuffle.
测试YARN环境
启动hdfs
start-dfs.sh
启动hdfs
Start-yarn.sh
使⽤浏览器打开页⾯:
master:8088/
或192.168.50.100:8088/
测试Mapreduce环境(运⾏Wordcount⽰例)
find /usr/local/hadoop -name *example*.jar
/
/查找⽰例程序,⽬录名需根据⾃⼰环境适当调整。
在HDFS上创建input⽬录
hdfs dfs -mkdir input
在HDFS上创建output⽬录
分数除以分数
hdfs dfs -mkdir output
创建运⾏⽰例⽂档并进⾏编写:
例:
helol
123
hello world
hello java
hello html
hello css
hello c
hello c#
hello world
hello css
hello c
纯牛奶洗脸hello c#
hello world
hello css
qq免费背景
hello css
hello css
hello c
hello c#
hello world
hello c
hello c#
hello world
hello c
hello c#
hello world
hello css
hello c
hello c#
hello world
hello css
hello c
将上传到HDFS中input⽬录下:
hdfs dfs - /input
洗涤读音
查看:
hdfs dfs -ls /input
运⾏Wordcount⽰例程序:
输⼊为:/ ,运⾏结果输出⽬录为: /output
hadoop jar /usr/local/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar wordcount /  /output
出现错误(FileAlreadyExistsException: Output directory hdfs://master:9000/output already exists):
会天大雨原因:
上次运⾏的输出⽬录也是output,没有进⾏删除。(好像每次运⾏的输出⽬录不能存在,运⾏过程中⾃动创建,若存在则运⾏失败,也有可能是我重复执⾏同⼀个⽂件的原因)
解决⽅法:
将/output⽬录删除:
hdfs dfs -rm -r /output
再次运⾏,成功:
四维怎么看男女查看运⾏结果:
hdfs dfs -text /output/part-r-00000
注意事项:

本文发布于:2023-06-22 22:30:13,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1050441.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

上一篇:instruction造句
下一篇:BitBake_ur_manual
标签:存在   输出   程序   环境   删除   结果   节点   位置
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图