Home > Database > Mysql Tutorial > YARN ResourceManager HA配置的图文代码详解

YARN ResourceManager HA配置的图文代码详解

PHP中文网
Release: 2017-03-30 16:27:08
Original
2243 people have browsed it

YARN中的资源管理器(Resource Manager)负责整个系统的资源管理和调度,并内部维护了各个应用程序的ApplictionMaster信息,NodeManager信息,资源使用信息等。在2.4版本之后,Hadoop Common同样提供了HA的功能,解决了这样一个基础服务的可靠性和容错性问题

YARN中的资源管理器(Resource Manager)负责整个系统的资源管理和调度,并内部维护了各个应用程序的ApplictionMaster信息,NodeManager信息,资源使用信息等。在2.4版本之后,Hadoop Common同样提供了HA的功能,解决了这样一个基础服务的可靠性和容错性问题。其架构如下:
rm-ha-overview
RM HA与NN HA有诸多相同之处(NameNode HA配置详解 ):
(1). Active/Standby架构,同一时间只有一个RM处于活动状态(如上图所示)。
(2). 依赖zooKeeper实现。手动切换使用yarn rmadmin命令(类似hdfs haadmin命令),而自动故障转移使用ZKFailoverController。但不同的是,zkfc只作为RM中一个线程而非独立的守护进程来启动。
(3). 当存在多个RM时,客户端使用的yarn-site.xml需要指定RM的列表。 客户端, ApplicationMasters (AMs)和NodeManagers (NMs) 会以轮训的方式寻找活动状态的RM,也就是说AM
s和NMs需要自己提供容错机制。如果当前活动状态的RM挂掉了,那么会继续使用轮训的方式找到新的RM。这种逻辑的实现需要在yarn.client.failover-proxy-provider中指定使用的类:org.apache.hadoop.yarn.client.RMFailoverProxyProvider
此外,新的RM可以恢复之前RM的状态(详见ResourceManger Restart )。当启动RM Restart,重启后的RM就加载之前活动RM的状态信息并继续之前RM的操作,这样应用程序定期执行检查点操作,就可以避免工作内容的丢失。在Active/standby的RM中,活动RM的状态数据需要active和standby都能访问,使用共享文件系统方法(FileSystemRMStateStore )或者zooKeeper方法(ZKRMStateStore)。后者在同一时间只允许一个RM有写入权限。

一个常见的YARN RM HA配置如下:

	yarn.resourcemanager.ha.enabled
	true
	yarn.resourcemanager.ha.rm-ids
	rm1,rm2
	yarn.resourcemanager.hostname.rm1
	debugo01
	yarn.resourcemanager.hostname.rm2
	debugo02
	yarn.resourcemanager.recovery.enabled
	true
	yarn.resourcemanager.store.class
        org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore
	yarn.resourcemanager.zk-address
        debugo01:2181,debugo02:2181,debugo03:2181
        For multiple zk services, separate them with comma
	yarn.resourcemanager.cluster-id
	yarn-ha
	yarn.resourcemanager.ha.automatic-failover.enabled
	true
	Enable automatic failover; By default, it is enabled only when HA is enabled.
  yarn.resourcemanager.ha.automatic-failover.zk-base-path
  /yarn-leader-election
Optional setting. The default value is /yarn-leader-election
	yarn.client.failover-proxy-provider
	org.apache.hadoop.yarn.client.RMFailoverProxyProvider
Copy after login

同时,yarn RM服务监听地址的设置要修改成下面的方式:

yarn.resourcemanager.address.rm1
                debugo01:8132
                yarn.resourcemanager.address.rm2
                debugo02:8132
                yarn.resourcemanager.scheduler.address.rm1
                debugo01:8130
                yarn.resourcemanager.scheduler.address.rm2
                debugo02:8130
                yarn.resourcemanager.resource-tracker.address.rm1
                debugo01:8131
               yarn.resourcemanager.resource-tracker.address.rm2
                debugo02:8131
                yarn.resourcemanager.webapp.address.rm1
                debugo01:8188
                yarn.resourcemanager.webapp.address.rm2
                debugo02:8188
Copy after login

启动RM
start-yarn.sh
在standby的节点单独启动RM(也可使用start-yarn.sh脚本)

检查状态:

$ yarn rmadmin -getServiceState rm1
active
$ yarn rmadmin -getServiceState rm2
standby
Copy after login

访问rm2节点的nodemanager会提示
This is standby RM. Redirecting to the current active RM: http://debugo01:8188/cluster/apps
下面KILL掉rm1的resourcemanager

[hadoop@debugo01 logs]$ yarn rmadmin -getServiceState rm2
active
[hadoop@debugo01 logs]$  yarn rmadmin -getServiceState rm1
14/09/14 03:08:23 INFO ipc.Client: Retrying connect to server: debugo01/192.168.46.201:8033. 
Already tried 0 time(s); 
retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=1, sleepTime=1000 MILLISECONDS)
Operation failed: Call From debugo01/192.168.46.201 to debugo01:8033 failed on 
connection exception: java.net.ConnectException: Connection refused; 
For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
Copy after login


以上就是YARN ResourceManager HA配置的图文代码详解的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template