您好,登錄后才能下訂單哦!
resource manager HA是hadoop自從2.4之后推出的功能,以Active/Standby的方式提供冗余,目的是為了消除單點(diǎn)失敗的風(fēng)險(xiǎn)。
1、總體架構(gòu):
2、故障切換:有自動(dòng)和手動(dòng)兩種形式。
手動(dòng):如果以手動(dòng)形式切換,使用yarn haadmin命令首先將Active節(jié)點(diǎn)轉(zhuǎn)為standby,再將standby節(jié)點(diǎn)轉(zhuǎn)為active。
自動(dòng):RM有基于zookeeper的節(jié)點(diǎn)選舉機(jī)制決定哪一個(gè)是活動(dòng)節(jié)點(diǎn)。不需要像HDFS一樣部署一個(gè)zkfc守護(hù)進(jìn)程,因?yàn)镽M內(nèi)嵌了這樣的功能。
做了rm的HA之后,所有節(jié)點(diǎn)和客戶(hù)端都要列出所有RM節(jié)點(diǎn),連接時(shí)會(huì)用輪詢(xún)的方式遍歷,直到找到一個(gè)active的節(jié)點(diǎn)。如果活動(dòng)節(jié)點(diǎn)down了,它們會(huì)繼續(xù)輪詢(xún)。這一動(dòng)作被實(shí)現(xiàn)為org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider類(lèi)。可以通過(guò)重新實(shí)現(xiàn)該類(lèi),并在yarn.client.failover-proxy-provider 配置項(xiàng)中指定新的類(lèi)名來(lái)改寫(xiě)這一行為邏輯。
3、配置
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. |
yarn.resourcemanager.ha.rm-ids | List of logical IDs for the RMs. e.g., “rm1,rm2”. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
yarn.resourcemanager.ha.automatic-failover.enabled | Enable automatic failover; By default, it is enabled only when HA is enabled. |
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. |
yarn.resourcemanager.cluster-id | Identifies the cluster. Used by the elector to ensure an RM doesn’t take over as Active for another cluster. |
yarn.client.failover-proxy-provider | The class to be used by Clients, AMs and NMs to failover to the Active 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. |
yarn.client.failover-retries-on-socket-timeouts | The number of retries per attempt to connect to a ResourceManager on socket timeouts. |
4、示例(最小配置)
<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>
5、管理命令
查看節(jié)點(diǎn)狀態(tài):
$ yarn rmadmin -getServiceState rm1
active
$ yarn rmadmin -getServiceState rm2
standby
故障切換:
$ yarn rmadmin -transitionToStandby rm1
$ yarn rmadmin -transitionToActive rm2
注意:
開(kāi)啟自動(dòng)故障切換后,系統(tǒng)為防止造成腦裂或其它不一致的狀態(tài),會(huì)拒絕人為管理HA狀態(tài)。如果非常清楚自己的行為,可以在切換命令中指定-forcemanual選項(xiàng)。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。