vlambda博客
学习文章列表

走进大数据丨 企业级YARN部署

YARN的工作机制:

部署YARN的HA集群首先需要部署HDFS的HA:

1、环境准备

Linuxcentos 7hadoop-2.8.4.tar.gzzookeeper-3.4.10.tar.gzjdk-8u144-linux-x64.tar.gz

2、集群规划

bigdata111
bigdata112
bigdata113

NameNode

NameNode

JournalNode

JournalNode

JournalNode

DataNode

DataNode

DataNode

ZK
ZK ZK

ResourceManager

ResourceManager


NodeManager

NodeManager

NodeManager

3、集群部署,在部署成功HDFS的HA的基础上

3.1、修改yarn-site.xml配置文件

<configuration>
<property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property>
<!--启用resourcemanager ha--> <property> <name>yarn.resourcemanager.ha.enabled</name> <value>true</value> </property> <!--声明两台resourcemanager的地址--> <property> <name>yarn.resourcemanager.cluster-id</name> <value>cluster-yarn1</value> </property>
<property> <name>yarn.resourcemanager.ha.rm-ids</name> <value>rm1,rm2</value> </property>
<property> <name>yarn.resourcemanager.hostname.rm1</name> <value>bigdata111</value> </property>
<property> <name>yarn.resourcemanager.hostname.rm2</name>        <value>bigdata112</value> </property> <!--指定zookeeper集群的地址--> <property> <name>yarn.resourcemanager.zk-address</name>        <value>bigdata111:2181,bigdata112:2181,bigdata113:2181</value> </property>
<!--启用自动恢复--> <property> <name>yarn.resourcemanager.recovery.enabled</name> <value>true</value> </property> <!--指定resourcemanager的状态信息存储在zookeeper集群--> <property> <name>yarn.resourcemanager.store.class</name>        <value>org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore</value> </property>
</configuration>

3.2、同步各个节点的配置文件

#拷贝到112节点scp /opt/module/HA/hadoop-2.8.4/etc/hadoop/yarn-site.xml root@bigdata112:/opt/module/HA/hadoop-2.8.4/etc/hadoop/#拷贝到113节点scp /opt/module/HA/hadoop-2.8.4/etc/hadoop/yarn-site.xml root@bigdata113:/opt/module/HA/hadoop-2.8.4/etc/hadoop/

3.3、在bigdata111中执行:

sbin/start-yarn.sh

3.4、在bigdata112中执行:

sbin/yarn-daemon.sh start resourcemanage

3.5、查看服务状态:

bin/yarn rmadmin -getServiceState rm1

3.6、使用bigdata111的ip登录YARN的web页面:ip:8088

恭喜,YARN的HA模式部署成功!