关于yarn:Yarn高可用集群

41次阅读

共计 3923 个字符,预计需要花费 10 分钟才能阅读完成。

批改配置文件 yarn-site.xml:

<?xml version="1.0"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->
<configuration>
  <property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
  </property>
 <!-- 启用 resourcemanager ha -->
  <property>
     <name>yarn.resourcemanager.ha.enabled</name>
     <value>true</value>
  </property>
 <!-- 申明 resourcemanager 的地址 -->
  <property>
    <name>yarn.resourcemanager.cluster-id</name>
    <value>cluster-yarn1</value>
  </property>
 <!-- 指定 resourcemanager 的逻辑列表 -->
  <property>
    <name>yarn.resourcemanager.ha.rm-ids</name>
    <value>rm1,rm2,rm3</value>
  </property>
<!-- ========== rm1 的配置 ========== -->
  <!-- 指定 rm1 的主机名 -->
  <property>
    <name>yarn.resourcemanager.hostname.rm1</name>
    <value>hadoop-4</value>
  </property>
<!-- 指定 rm1 的 web 端地址 -->
<property>
 <name>yarn.resourcemanager.webapp.address.rm1</name>
 <value>hadoop-4:8088</value>
</property>
<!-- 指定 rm1 的外部通信地址 -->
<property>
 <name>yarn.resourcemanager.address.rm1</name>
 <value>hadoop-4:8032</value>
</property>
<!-- 指定 AM 向 rm1 申请资源的地址 -->
<property>
<name>yarn.resourcemanager.scheduler.address.rm1</name> 
 <value>hadoop-4:8030</value>
</property>
<!-- 指定供 NM 连贯的地址 --> 
<property>
 <name>yarn.resourcemanager.resource-tracker.address.rm1</name>
 <value>hadoop-4:8031</value>
</property>
<!-- ========== rm2 的配置 ========== -->
 <!-- 指定 rm2 的主机名 -->
 <property>
 <name>yarn.resourcemanager.hostname.rm2</name>
 <value>hadoop-5</value>
</property>
<property>
 <name>yarn.resourcemanager.webapp.address.rm2</name>
 <value>hadoop-5:8088</value>
</property>
<property>
 <name>yarn.resourcemanager.address.rm2</name>
 <value>hadoop-5:8032</value>
</property>
<property>
 <name>yarn.resourcemanager.scheduler.address.rm2</name>
 <value>hadoop-5:8030</value>
</property>
<property>
 <name>yarn.resourcemanager.resource-tracker.address.rm2</name>
 <value>hadoop-5:8031</value>
</property>
<!-- ========== rm3 的配置 ========== -->
<!-- 指定 rm1 的主机名 -->
 <property>
 <name>yarn.resourcemanager.hostname.rm3</name>
 <value>hadoop-6</value>
</property>
<!-- 指定 rm1 的 web 端地址 -->
<property>
 <name>yarn.resourcemanager.webapp.address.rm3</name>
 <value>hadoop-6:8088</value>
</property>
<!-- 指定 rm1 的外部通信地址 -->
<property>
 <name>yarn.resourcemanager.address.rm3</name>
<value>hadoop-6:8032</value>
</property>
<!-- 指定 AM 向 rm1 申请资源的地址 -->
<property>
 <name>yarn.resourcemanager.scheduler.address.rm3</name> 
 <value>hadoop-6:8030</value>
</property>
<!-- 指定供 NM 连贯的地址 --> 
<property>
 <name>yarn.resourcemanager.resource-tracker.address.rm3</name>
 <value>hadoop-6:8031</value>
</property>
 <!-- 指定 zookeeper 集群的地址 --> 
 <property>
 <name>yarn.resourcemanager.zk-address</name>
 <value>hadoop-4:2181,hadoop-5:2181,hadoop-6:2181</value>
 </property>
 <!-- 启用主动复原 --> 
 <property>
 <name>yarn.resourcemanager.recovery.enabled</name>
 <value>true</value>
 </property>
 <!-- 指定 resourcemanager 的状态信息存储在 zookeeper 集群 --> 
 <property>
 <name>yarn.resourcemanager.store.class</name> 
<value>org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore</value>
</property>
<!-- 环境变量的继承 -->
<property>
 <name>yarn.nodemanager.env-whitelist</name>
  <value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value>
 </property>
<!-- 日志汇集 -->
 <property>
   <name>yarn.log-aggregation-enable</name>
   <value>true</value>
 </property>
<!-- 日志汇集服务器地址 -->
 <property>
   <name>yarn.log.server.url</name>
   <value>http://hadoop-4:19888/jobhistory/logs</value>
 </property>
<!-- 日志保留工夫 -->
 <property>
   <name>yarn.log-aggregation.retain-seconds</name>
   <value>6048000</value>
 </property>
</configuration>

获取 yarn 集群状态:
yarn rmadmin -getServiceState rm1
启动 hadoop 集群:
start-all.sh

yarn-web 端

http://192.168.0.120:8088/clu…

其余:

配置 Windows10 的 hosts 文件,C:\Windows\System32\drivers\etc

正文完
 0