1. 程式人生 > >Hadoop叢集的ResourceManager HA高可用配置

Hadoop叢集的ResourceManager HA高可用配置

ResourceManager HA

yarn-site.xml:

<configuration>

<!-- Site specific YARN configuration properties -->
<property>
        <name>yarn.nodemanager.aux-services</name>
        <value>mapreduce_shuffle</value>
    </property>
  <property>
        <name> yarn.resourcemanager.hostname</name>
        <value>172.17.0.3</value>
    </property>
<property>
        <name>yarn.log-aggregation-enable</name>
        <value>true</value>
    </property>
<property>
        <name>yarn.log-aggregation.retain-seconds</name>
        <value>640800</value>
    </property>
<property>
        <name>yarn.nodemanager.resource.memory-mb</name>
        <value>4096</value>
    </property>
<property>
        <name>yarn.nodemanager.resource.cpu-vcores</name>

        <value>4</value>

</property>

<property> 
	 <name>yarn.log.server.url</name> 
	  <value>http://cdh0:19888/jobhistory/logs/</value> 
  </property>
  <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>cdh1,cdh2</value>
 </property> 
 <property>
	  <name>yarn.resourcemanager.hostname.cdh1</name>
	   <value>cdh1</value>
</property>
<property>
	 <name>yarn.resourcemanager.hostname.cdh2</name>
	  <value>cdh2</value>
  </property>
  <property>
<!--指定 zookeeper 叢集的地址--> 
	   <name>yarn.resourcemanager.zk-address</name>
	    <value>cdh0:2181,cdh1:2181,cdh2:2181</value>
    </property>
    <property>
<!--啟用自動恢復--> 
	     <name>yarn.resourcemanager.recovery.enabled</name>
	      <value>true</value>
 </property>
 <property>
<!--指定 resourcemanager 的狀態資訊儲存在 zookeeper 叢集--> 
	  <name>yarn.resourcemanager.store.class</name> 
	  <value>org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore</value>
	   </property>
</configuration>

使用scp命令拷貝給其他兩臺機器

在cdh1中啟動ResourceManager和NodeManager

sbin/start-yarn.sh

在cdh2中啟動ResourceManager

sbin/yarn-daemon.sh start resourcemanager

檢視cdh2中的服務

 bin/yarn rmadmin -getServiceState cdh2

 

至此ResourceManager HA完成