Hadoop官方文檔翻譯—— YARN ResourceManager High Availability 2.7.3

ResourceManager High Availability (RM高可用)

 

Introduction

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.html

這個知道提供YARN的ResourceManager的高可用綜述,和如何配置和使用這個特性的細節。RM負責跟蹤集羣中的資源和調度應用(例如 MapReduce做業)。在Hadoop2.4以前,RM是YARN集羣中的一個單點故障。這個高可用特性以活動/備用 RM對的形式增長了冗餘來移除這個潛在的單點故障。node

Architecture(架構)

RM Failover(RM故障切換)

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.web

RM的高可用特性經過任什麼時候間點的主/備架構來實現的,一個RM做爲活動,而其餘RMs進入備用模式隨時等待接管出事的活動的RM。備用轉活躍的觸發能夠經過管理員用命令行或者經過集成的故障切換控制器配置容許自動故障切換。apache

Manual transitions and failover(手動切換和故障切換)

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 「yarn rmadmin」 CLI.架構

當自動故障切換沒有被激活時,管理員必須手動地轉換RMs中的一個爲活躍。RM的故障切換時首先將活躍的RM切換爲備用而後將一個備用的RM切換爲活躍狀態。這些均可以用「yarn rmadmin」命令行來實現。app

Automatic failover(自動故障切換)

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.webapp

RMa有個選項來嵌入基於Zookeepper的主備選舉機制來決定哪一個RM是活躍的。當活躍的RM失效或者反應遲鈍,另外一個RM會被自動選舉爲主用而後接管工做。須要注意的是,不必爲HDFS運行一個單獨的ZKFC進程由於主備選舉機制內嵌到RMs做爲一個失效檢查器和選舉器來替代一個單獨的ZKFC進程。socket

Client, ApplicationMaster and NodeManager on RM failover(客戶端、應用控制器和節點管理器在RM的故障切換下的轉移)

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 org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider. You can override the logic by implementing org.apache.hadoop.yarn.client.RMFailoverProxyProvider and setting the value of yarn.client.failover-proxy-provider to the class name.ide

當有多個RM,客戶端和節點能夠經過配置(yarn-site.xml)來得到RM的列表。客戶端、應用控制器和節點管理器採用循環的方式來試圖連上RM直到他們連上活躍RM。若是活躍的RM失效了,它們從新開始以循環的方式去鏈接RM直到他們連上新的活躍RM。這個默認的重試邏輯是org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider實現的。你能夠經過實現 org.apache.hadoop.yarn.client.RMFailoverProxyProvider 來覆蓋這個邏輯並將yarn.client.failover-proxy-provider的值設爲該類名。oop

Recovering prevous active-RM’s state(恢復到以前活躍RM的狀態)

With the ResourceManger Restart 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 ZKRMStateStore 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 「zookeeper.DigestAuthenticationProvider.superDigest」 property on the Zookeeper cluster to ensure that the zookeeper admin does not have access to YARN application/user credential information.

若是RM重啓是被激活可用的,依靠RM的重啓特性一個RM被提高爲活躍RM狀態時加載前面那個活躍RM留下儘量多的RM的內部狀態和操做。應用能夠週期的檢查來避免丟失任何工做。狀態倉庫對主用/備用RM都是可見的。目前,有兩個實現的持久化RM狀態倉庫- FileSystemRMStateStore和ZKRMStateStore。ZKRMStateStore容許在任何一個時間點只對一個RM可寫,所以推薦在HA集羣中使用這個倉庫。當使用ZKRMStateStore做爲狀態倉庫,建議不要在Zookepper集羣中設置zookeeper.DigestAuthenticationProvider.superDigest屬性確保zookepper管理員沒有進入YARN 應用和用戶的權限信息。

Deployment(部署)

Configurations(配置)

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 yarn-default.xml for more information including default values. See the document for ResourceManger Restart also for instructions on setting up the state-store.

大部分的故障切換功能均可以用各樣的配置屬性來調用。下面是屬性中須要的/重要的部分列表。yarn-default.xml是完整的開關列表。去查看 yarn-default.xml 獲取更多信息包括默認值。看ResourceManger Restart 文檔也能夠獲得狀態倉庫的設置信息。

Configuration Properties

Description

yarn.resourcemanager.zk-address

Address of the ZK-quorum. Used both for the state-store and embedded leader-election.

yarn.resourcemanager.ha.enabled

Enable RM HA.

RM高可用激活

yarn.resourcemanager.ha.rm-ids

List of logical IDs for the RMs. e.g., 「rm1,rm2」.

RMs的邏輯ID列表

yarn.resourcemanager.hostname.rm-id

For each rm-id, specify the hostname the RM corresponds to. Alternately, one could set each of the RM’s service addresses.

爲每一個RM-id指定一個主機名。或者能夠設置每一個RM的服務地址

yarn.resourcemanager.address.rm-id

For each rm-id, specify host:port for clients to submit jobs. If set, overrides the hostname set in yarn.resourcemanager.hostname.rm-id.

爲每一個rm-id設置主機:端口用來提交做業。若是設置,將覆蓋yarn.resourcemanager.hostname.rm-id的設置

yarn.resourcemanager.scheduler.address.rm-id

For each rm-id, specify scheduler host:port for ApplicationMasters to obtain resources. If set, overrides the hostname set in yarn.resourcemanager.hostname.rm-id.

爲每一個rm-id指定AM的主機:端口來獲取資源。若是設置了將覆蓋yarn.resourcemanager.hostname.rm-id的設置

yarn.resourcemanager.resource-tracker.address.rm-id

For each rm-id, specify host:port for NodeManagers to connect. If set, overrides the hostname set in yarn.resourcemanager.hostname.rm-id.

爲每一個rm-id指定NodeManagers的鏈接的主機:端口。若是設置將覆蓋yarn.resourcemanager.hostname.rm-id的設置

yarn.resourcemanager.admin.address.rm-id

For each rm-id, specify host:port for administrative commands. If set, overrides the hostname set in yarn.resourcemanager.hostname.rm-id.

爲每一個rm-id設置管理命令行的主機:端口。若是設置了將覆蓋yarn.resourcemanager.hostname.rm-id的設置

yarn.resourcemanager.webapp.address.rm-id

For each rm-id, specify host:port of the RM web application corresponds to. You do not need this if you set yarn.http.policy to HTTPS_ONLY. If set, overrides the hostname set in yarn.resourcemanager.hostname.rm-id.

爲每一個rm-id指定用於RMweb應用通信的主機:端口。若是你設置了yarn.http.policy to HTTPS_ONLY那就不必設置了。若是設置了將覆蓋yarn.resourcemanager.hostname.rm-id的設置

yarn.resourcemanager.webapp.https.address.rm-id

For each rm-id, specify host:port of the RM https web application corresponds to. You do not need this if you set yarn.http.policy to HTTP_ONLY. If set, overrides the hostname set in yarn.resourcemanager.hostname.rm-id.

爲每一個rm-id指定用於RM https web應用通信的主機:端口。若是你設置了yarn.http.policy to HTTPS_ONLY那就不必設置了。若是設置了將覆蓋yarn.resourcemanager.hostname.rm-id的設置

yarn.resourcemanager.ha.id

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.

定義一個RM的集合ID.這是可選的;然而,若是設置了,管理員將要確保全部的RM全部本身的ID

yarn.resourcemanager.ha.automatic-failover.enabled

Enable automatic failover; By default, it is enabled only when HA is enabled.

故障切換激活;默認的,在HA激活下可用。

yarn.resourcemanager.ha.automatic-failover.embedded

Use embedded leader-elector to pick the Active RM, when automatic failover is enabled. By default, it is enabled only when HA is enabled.

當自動故障切換可用時,使用內嵌的選舉器來選擇活躍RM。默認的,在HA激活下可用。

yarn.resourcemanager.cluster-id

Identifies the cluster. Used by the elector to ensure an RM doesn’t take over as Active for another cluster.

定義集羣的ID。被選舉器使用確保RM不會在其餘集羣中接管稱爲活躍RM

yarn.client.failover-proxy-provider

The class to be used by Clients, AMs and NMs to failover to the Active RM.

這個類用於將客戶端、AMs和NMs轉移到活躍的RM

yarn.client.failover-max-attempts

The max number of times FailoverProxyProvider should attempt failover.

嘗試故障切換的最大嘗試次數。

yarn.client.failover-sleep-base-ms

The sleep base (in milliseconds) to be used for calculating the exponential delay between failovers.

yarn.client.failover-sleep-max-ms

The maximum sleep time (in milliseconds) between failovers.

故障切換之間的最大休眠時間

yarn.client.failover-retries

The number of retries per attempt to connect to a ResourceManager.

每一個嘗試鏈接RM的重連次數

yarn.client.failover-retries-on-socket-timeouts

The number of retries per attempt to connect to a ResourceManager on socket timeouts.

每一個嘗試鏈接RM的重連次數的socket超時

Sample configurations(配置例子)

Here is the sample of minimal setup for RM failover.

<property>
  <name>yarn.resourcemanager.ha.enabled</name>
  <value>true</value>
</property>
<property>
  <name>yarn.resourcemanager.cluster-id</name>
  <value>cluster1</value>
</property>
<property>
  <name>yarn.resourcemanager.ha.rm-ids</name>
  <value>rm1,rm2</value>
</property>
<property>
  <name>yarn.resourcemanager.hostname.rm1</name>
  <value>master1</value>
</property>
<property>
  <name>yarn.resourcemanager.hostname.rm2</name>
  <value>master2</value>
</property>
<property>
  <name>yarn.resourcemanager.webapp.address.rm1</name>
  <value>master1:8088</value>
</property>
<property>
  <name>yarn.resourcemanager.webapp.address.rm2</name>
  <value>master2:8088</value>
</property>
<property>
  <name>yarn.resourcemanager.zk-address</name>
  <value>zk1:2181,zk2:2181,zk3:2181</value>
</property>

 

Admin commands(管理員命令)

yarn rmadmin 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 yarn.resourcemanager.ha.rm-ids as argument.

 $ yarn rmadmin -getServiceState rm1
 active
 
 $ yarn rmadmin -getServiceState rm2
 standby

 

If automatic failover is enabled, you can not use manual transition command. Though you can override this by –forcemanual flag, you need caution.

 $ 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.

 

See YarnCommands for more details.

ResourceManager Web UI services

Assuming a standby RM is up and running, the Standby automatically redirects all web requests to the Active, except for the 「About」 page.

假設一個備用RM被提高爲活躍,該備用RM會自動重定向到全部提到活躍RM的請求,除了「About」頁面

Web Services

Assuming a standby RM is up and running, RM web-services described at ResourceManager REST APIs when invoked on a standby RM are automatically redirected to the Active RM.

假設一個備用RM被提高爲活躍,RM web-service在ResourceManager REST APIs 描述的用來將一個備用RM自動重定向活躍RM。

 

*因爲譯者自己能力有限,因此譯文中確定會出現表述不正確的地方,請你們多多包涵,也但願你們可以指出文中翻譯得不對或者不許確的地方,共同探討進步,謝謝。

相關文章
相關標籤/搜索