<p>This guide provides an overview of High Availability of YARN’s ResourceManager, and details how to configure and use this feature. The ResourceManager (RM) is responsible for tracking the resources in a cluster, and scheduling applications (e.g., MapReduce jobs). Prior to Hadoop 2.4, the ResourceManager is the single point of failure in a YARN cluster. The High Availability feature adds redundancy in the form of an Active/Standby ResourceManager pair to remove this otherwise single point of failure.</p></section><section>
<h2><aname="Architecture"></a>Architecture</h2>
<p><imgsrc="images/rm-ha-overview.png"alt="Overview of ResourceManager High Availability"/></p><section>
<h3><aname="RM_Failover"></a>RM Failover</h3>
<p>ResourceManager HA is realized through an Active/Standby architecture - at any point of time, one of the RMs is Active, and one or more RMs are in Standby mode waiting to take over should anything happen to the Active. The trigger to transition-to-active comes from either the admin (through CLI) or through the integrated failover-controller when automatic-failover is enabled.</p><section>
<h4><aname="Manual_transitions_and_failover"></a>Manual transitions and failover</h4>
<p>When automatic failover is not enabled, admins have to manually transition one of the RMs to Active. To failover from one RM to the other, they are expected to first transition the Active-RM to Standby and transition a Standby-RM to Active. All this can be done using the “<code>yarn rmadmin</code>” CLI.</p></section><section>
<p>The RMs have an option to embed the Zookeeper-based ActiveStandbyElector to decide which RM should be the Active. When the Active goes down or becomes unresponsive, another RM is automatically elected to be the Active which then takes over. Note that, there is no need to run a separate ZKFC daemon as is the case for HDFS because ActiveStandbyElector embedded in RMs acts as a failure detector and a leader elector instead of a separate ZKFC deamon.</p></section><section>
<h4><aname="Client.2C_ApplicationMaster_and_NodeManager_on_RM_failover"></a>Client, ApplicationMaster and NodeManager on RM failover</h4>
<p>When there are multiple RMs, the configuration (yarn-site.xml) used by clients and nodes is expected to list all the RMs. Clients, ApplicationMasters (AMs) and NodeManagers (NMs) try connecting to the RMs in a round-robin fashion until they hit the Active RM. If the Active goes down, they resume the round-robin polling until they hit the “new” Active. This default retry logic is implemented as <code>org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider</code>. You can override the logic by implementing <code>org.apache.hadoop.yarn.client.RMFailoverProxyProvider</code> and setting the value of <code>yarn.client.failover-proxy-provider</code> to the class name. When running in non-ha mode, set the value of <code>yarn.client.failover-no-ha-proxy-provider</code> instead</p></section></section><section>
<p>With the <ahref="./ResourceManagerRestart.html">ResourceManager Restart</a> enabled, the RM being promoted to an active state loads the RM internal state and continues to operate from where the previous active left off as much as possible depending on the RM restart feature. A new attempt is spawned for each managed application previously submitted to the RM. Applications can checkpoint periodically to avoid losing any work. The state-store must be visible from the both of Active/Standby RMs. Currently, there are two RMStateStore implementations for persistence - FileSystemRMStateStore and ZKRMStateStore. The <code>ZKRMStateStore</code> implicitly allows write access to a single RM at any point in time, and hence is the recommended store to use in an HA cluster. When using the ZKRMStateStore, there is no need for a separate fencing mechanism to address a potential split-brain situation where multiple RMs can potentially assume the Active role. When using the ZKRMStateStore, it is advisable to NOT set the “<code>zookeeper.DigestAuthenticationProvider.superDigest</code>” property on the Zookeeper cluster to ensure that the zookeeper admin does not have access to YARN application/user credential information.</p></section></section><section>
<p>Most of the failover functionality is tunable using various configuration properties. Following is a list of required/important ones. yarn-default.xml carries a full-list of knobs. See <ahref="../hadoop-yarn-common/yarn-default.xml">yarn-default.xml</a> for more information including default values. See the document for <ahref="./ResourceManagerRestart.html">ResourceManager Restart</a> also for instructions on setting up the state-store.</p>
<tdalign="left"> For each <i>rm-id</i>, specify the hostname the RM corresponds to. Alternately, one could set each of the RM’s service addresses. </td></tr>
<tdalign="left"> For each <i>rm-id</i>, specify host:port for clients to submit jobs. If set, overrides the hostname set in <code>yarn.resourcemanager.hostname.</code><i>rm-id</i>. </td></tr>
<tdalign="left"> For each <i>rm-id</i>, specify scheduler host:port for ApplicationMasters to obtain resources. If set, overrides the hostname set in <code>yarn.resourcemanager.hostname.</code><i>rm-id</i>. </td></tr>
<tdalign="left"> For each <i>rm-id</i>, specify host:port for NodeManagers to connect. If set, overrides the hostname set in <code>yarn.resourcemanager.hostname.</code><i>rm-id</i>. </td></tr>
<tdalign="left"> For each <i>rm-id</i>, specify host:port for administrative commands. If set, overrides the hostname set in <code>yarn.resourcemanager.hostname.</code><i>rm-id</i>. </td></tr>
<tdalign="left"> For each <i>rm-id</i>, specify host:port of the RM web application corresponds to. You do not need this if you set <code>yarn.http.policy</code> to <code>HTTPS_ONLY</code>. If set, overrides the hostname set in <code>yarn.resourcemanager.hostname.</code><i>rm-id</i>. </td></tr>
<tdalign="left"> For each <i>rm-id</i>, specify host:port of the RM https web application corresponds to. You do not need this if you set <code>yarn.http.policy</code> to <code>HTTP_ONLY</code>. If set, overrides the hostname set in <code>yarn.resourcemanager.hostname.</code><i>rm-id</i>. </td></tr>
<tdalign="left"> Identifies the RM in the ensemble. This is optional; however, if set, admins have to ensure that all the RMs have their own IDs in the config. </td></tr>
<tdalign="left"> Use embedded leader-elector to pick the Active RM, when automatic failover is enabled. By default, it is enabled only when HA is enabled. </td></tr>
<p><code>yarn rmadmin</code> has a few HA-specific command options to check the health/state of an RM, and transition to Active/Standby. Commands for HA take service id of RM set by <code>yarn.resourcemanager.ha.rm-ids</code> as argument.</p>
<divclass="source">
<divclass="source">
<pre> $ yarn rmadmin -getServiceState rm1
active
$ yarn rmadmin -getServiceState rm2
standby
</pre></div></div>
<p>If automatic failover is enabled, you can not use manual transition command. Though you can override this by –forcemanual flag, you need caution.</p>
<divclass="source">
<divclass="source">
<pre> $ yarn rmadmin -transitionToStandby rm1
Automatic failover is enabled for org.apache.hadoop.yarn.client.RMHAServiceTarget@1d8299fd
Refusing to manually manage HA state, since it may cause
a split-brain scenario or other incorrect state.
If you are very sure you know what you are doing, please
specify the forcemanual flag.
</pre></div></div>
<p>See <ahref="./YarnCommands.html">YarnCommands</a> for more details.</p></section><section>
<h3><aname="ResourceManager_Web_UI_services"></a>ResourceManager Web UI services</h3>
<p>Assuming a standby RM is up and running, the Standby automatically redirects all web requests to the Active, except for the “About” page.</p></section><section>
<h3><aname="Web_Services"></a>Web Services</h3>
<p>Assuming a standby RM is up and running, RM web-services described at <ahref="./ResourceManagerRest.html">ResourceManager REST APIs</a> when invoked on a standby RM are automatically redirected to the Active RM.</p></section><section>
<p>If you are running a set of ResourceManagers behind a Load Balancer (e.g. <aclass="externalLink"href="https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-custom-probe-overview">Azure</a> or <aclass="externalLink"href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-healthchecks.html">AWS</a> ) and would like the Load Balancer to point to the active RM, you can use the /isActive HTTP endpoint as a health probe. <aclass="externalLink"href="http://RM_HOSTNAME/isActive">http://RM_HOSTNAME/isActive</a> will return a 200 status code response if the RM is in Active HA State, 405 otherwise.</p></section></section>