Yarn集群的搭建和WordCount程序在集群提交方式

一、Yarn集群概述及搭建

  1.Mapreduce程序运行在多台机器的集群上,而且在运行是要使用很多maptask和reducertask,这个过程中需要一个自动化任务调度平台来调度任务,分配资源,这个平台就是Yarn!

  2.Yarn提交任务的流程:

    当我们向Yarn集群提交任务后,Yarn通过Resourcemanager给任务分配资源,然后由NodeManager开辟运算空间来执行任务,在这个运算空间中开辟maptask和reducetask来运行任务。

  3.Yarn集群的搭建

  修改配置文件yarn.site.xml,添加配置信息

<property>
	<name>yarn.resourcemanager.hostname</name>
	<value>hd1-1</value>
</property> 
<property>
	<name>yarn.nodemanager.aux-services</name>
	<value>mapreduce_shuffle</value>
</property>

  将配置好的文件传输到集群其他机器,修改slaves文件(hdfs集群配置比较麻烦,本人没有总结,请见谅)

  启动yarn集群  start-yarn.sh

  关闭yarn集群  stop-yarn.sh

  可以访问yarn的网页客户端,resourcemanager的ip加端口号8088,如:

  192.168.50.183:8088

二、WordCount程序提交到集群运行

  1.修改配置文件mapred-site.xml,添加配置:

<property>
	<name>mapreduce.framework.name</name>
	<value>yarn</value>
</property>

  2.将修改好的配置文件发送到集群其他机器

  3.启动hdfs、yarn集群,将wordCount程序打包上传到集群

  4.运行命令:

    hadoop jar WordCount.jar com.wyh.mr.WordCountDriver

 

猜你喜欢

转载自www.cnblogs.com/HelloBigTable/p/10586695.html
今日推荐