Apache Hadoop 2.9.2 的YARN High Available 模式部署

                                       作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.环境准备

1>.官方文档(http://hadoop.apache.org/docs/r2.9.2/hadoop-yarn/hadoop-yarn-site/ResourceManagerHA.html

2>.实验环境

  环境在上一篇博客基础之上,参考链接:https://www.cnblogs.com/yinzhengjie/p/10720586.html

二.修改核心配置

1>.修改yarn-site.xml

[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/hadoop-2.9./etc/hadoop/yarn-site.xml
<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>yinzhengjie-yarn</value>
</property> <property>
<name>yarn.resourcemanager.ha.rm-ids</name>
<value>resourcemanager1,resourcemanager2</value>
</property> <property>
<name>yarn.resourcemanager.hostname.resourcemanager1</name>
<value>node101.yinzhengjie.org.cn</value>
</property> <property>
<name>yarn.resourcemanager.hostname.resourcemanager2</name>
<value>node103.yinzhengjie.org.cn</value>
</property> <property>
<name>yarn.resourcemanager.webapp.address.resourcemanager1</name>
<value>node101.yinzhengjie.org.cn:</value>
</property> <property>
<name>yarn.resourcemanager.webapp.address.resourcemanager2</name>
<value>node103.yinzhengjie.org.cn:</value>
</property> <!--指定zookeeper集群的地址-->
<property>
<name>yarn.resourcemanager.zk-address</name>
<value>node101.yinzhengjie.org.cn:,node102.yinzhengjie.org.cn:,node101.yinzhengjie.org.cn:</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> </configuration>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#

[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/hadoop-2.9.2/etc/hadoop/yarn-site.xml

2>.将修改的配置文件同步到其他节点中

[root@node101.yinzhengjie.org.cn ~]# scp /yinzhengjie/softwares/hadoop-2.9./etc/hadoop/yarn-site.xml  node102.yinzhengjie.org.cn:/yinzhengjie/softwares/hadoop-2.9./etc/hadoop/
yarn-site.xml % .8MB/s :
[root@node101.yinzhengjie.org.cn ~]#

[root@node101.yinzhengjie.org.cn ~]# scp /yinzhengjie/softwares/hadoop-2.9.2/etc/hadoop/yarn-site.xml node102.yinzhengjie.org.cn:/yinzhengjie/softwares/hadoop-2.9.2/etc/hadoop/

[root@node101.yinzhengjie.org.cn ~]# scp /yinzhengjie/softwares/hadoop-2.9./etc/hadoop/yarn-site.xml  node103.yinzhengjie.org.cn:/yinzhengjie/softwares/hadoop-2.9./etc/hadoop/
yarn-site.xml % .0MB/s :
[root@node101.yinzhengjie.org.cn ~]#

[root@node101.yinzhengjie.org.cn ~]# scp /yinzhengjie/softwares/hadoop-2.9.2/etc/hadoop/yarn-site.xml node103.yinzhengjie.org.cn:/yinzhengjie/softwares/hadoop-2.9.2/etc/hadoop/

3>.启动hdfs集群

[root@node101.yinzhengjie.org.cn ~]# start-dfs.sh
Starting namenodes on [node101.yinzhengjie.org.cn node103.yinzhengjie.org.cn]
node101.yinzhengjie.org.cn: starting namenode, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-namenode-node101.yinzhengjie.org.cn.out
node103.yinzhengjie.org.cn: starting namenode, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-namenode-node103.yinzhengjie.org.cn.out
node103.yinzhengjie.org.cn: starting datanode, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-datanode-node103.yinzhengjie.org.cn.out
node102.yinzhengjie.org.cn: starting datanode, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-datanode-node102.yinzhengjie.org.cn.out
node101.yinzhengjie.org.cn: starting datanode, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-datanode-node101.yinzhengjie.org.cn.out
Starting journal nodes [node103.yinzhengjie.org.cn node102.yinzhengjie.org.cn node101.yinzhengjie.org.cn]
node103.yinzhengjie.org.cn: starting journalnode, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-journalnode-node103.yinzhengjie.org.cn.out
node102.yinzhengjie.org.cn: starting journalnode, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-journalnode-node102.yinzhengjie.org.cn.out
node101.yinzhengjie.org.cn: starting journalnode, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-journalnode-node101.yinzhengjie.org.cn.out
Starting ZK Failover Controllers on NN hosts [node101.yinzhengjie.org.cn node103.yinzhengjie.org.cn]
node101.yinzhengjie.org.cn: starting zkfc, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-zkfc-node101.yinzhengjie.org.cn.out
node103.yinzhengjie.org.cn: starting zkfc, logging to /yinzhengjie/softwares/hadoop-2.9./logs/hadoop-root-zkfc-node103.yinzhengjie.org.cn.out
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode1            #查看当前节点的状态!很显然,和下面的Web UI展示的结果一致!
active
[root@node101.yinzhengjie.org.cn ~]#

4>.启动yarn集群

[root@node101.yinzhengjie.org.cn ~]# start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /yinzhengjie/softwares/hadoop-2.9./logs/yarn-root-resourcemanager-node101.yinzhengjie.org.cn.out
node102.yinzhengjie.org.cn: starting nodemanager, logging to /yinzhengjie/softwares/hadoop-2.9./logs/yarn-root-nodemanager-node102.yinzhengjie.org.cn.out
node103.yinzhengjie.org.cn: starting nodemanager, logging to /yinzhengjie/softwares/hadoop-2.9./logs/yarn-root-nodemanager-node103.yinzhengjie.org.cn.out
node101.yinzhengjie.org.cn: starting nodemanager, logging to /yinzhengjie/softwares/hadoop-2.9./logs/yarn-root-nodemanager-node101.yinzhengjie.org.cn.out
[root@node101.yinzhengjie.org.cn ~]#

[root@node101.yinzhengjie.org.cn ~]# start-yarn.sh                        #在resourcemanager1节点上启动YARN

[root@node101.yinzhengjie.org.cn ~]# jps
ZooKeeperMain
Jps
QuorumPeerMain
DFSZKFailoverController
JournalNode
NameNode
NodeManager
ResourceManager
DataNode
[root@node101.yinzhengjie.org.cn ~]#

[root@node101.yinzhengjie.org.cn ~]# jps

[root@node103.yinzhengjie.org.cn ~]# yarn-daemon.sh start resourcemanager
starting resourcemanager, logging to /yinzhengjie/softwares/hadoop-2.9./logs/yarn-root-resourcemanager-node103.yinzhengjie.org.cn.out
[root@node103.yinzhengjie.org.cn ~]#
[root@node103.yinzhengjie.org.cn ~]# jps
Jps
ResourceManager
JournalNode
NodeManager
QuorumPeerMain
NameNode
DFSZKFailoverController
DataNode
[root@node103.yinzhengjie.org.cn ~]#

[root@node103.yinzhengjie.org.cn ~]# yarn-daemon.sh start resourcemanager          #在resourcemanager2节点上启动rm进程

[root@node103.yinzhengjie.org.cn ~]# jps
ResourceManager
JournalNode
NodeManager
QuorumPeerMain
NameNode
DFSZKFailoverController
Jps
DataNode
[root@node103.yinzhengjie.org.cn ~]#

[root@node103.yinzhengjie.org.cn ~]# jps

[root@node103.yinzhengjie.org.cn ~]# yarn rmadmin -getServiceState resourcemanager1        #很显然,我们先启动的是resourcemanager1节点,因此它优先被选为Active状态!
active
[root@node103.yinzhengjie.org.cn ~]#
[root@node103.yinzhengjie.org.cn ~]# yarn rmadmin -getServiceState resourcemanager2
standby
[root@node103.yinzhengjie.org.cn ~]#

三.验证YARN的高可用性

1>.将resourcemanager1节点进程杀掉,查看服务是否可以正常提供服务

[root@node101.yinzhengjie.org.cn ~]# jps
ZooKeeperMain
QuorumPeerMain
DFSZKFailoverController
JournalNode
NameNode
NodeManager
ResourceManager
DataNode
Jps
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# kill - `jps | grep ResourceManager | awk '{print $1}' `
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# jps
ZooKeeperMain
QuorumPeerMain
Jps
DFSZKFailoverController
JournalNode
NameNode
NodeManager
DataNode
[root@node101.yinzhengjie.org.cn ~]#  

2>.启动yarn集群后,注意观察zookeeper集群中生成的目录结构的变化哟!

[root@node101.yinzhengjie.org.cn ~]# zkCli.sh -server node103.yinzhengjie.org.cn:
Connecting to node103.yinzhengjie.org.cn:
-- ::, [myid:] - INFO [main:Environment@] - Client environment:zookeeper.version=3.4.-4c25d480e66aadd371de8bd2fd8da255ac140bcf, built on // : GMT
-- ::, [myid:] - INFO [main:Environment@] - Client environment:host.name=node101.yinzhengjie.org.cn
-- ::, [myid:] - INFO [main:Environment@] - Client environment:java.version=1.8.0_201
-- ::, [myid:] - INFO [main:Environment@] - Client environment:java.vendor=Oracle Corporation
-- ::, [myid:] - INFO [main:Environment@] - Client environment:java.home=/usr/lib/jvm/java-1.8.-openjdk-1.8.0.201.b09-.el7_6.x86_64/jre
-- ::, [myid:] - INFO [main:Environment@] - Client environment:java.class.path=/yinzhengjie/softwares/zookeeper-3.4./bin/../zookeeper-server/target/classes:/yinzhengjie/softwares/zookeeper-3.4./bin/../build/classes:/yinzhengjie/softwares/zookeeper-3.4./bin/../zookeeper-server/target/lib/*.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../build/lib/*.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../lib/slf4j-log4j12-1.7.25.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../lib/slf4j-api-1.7.25.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../lib/log4j-1.2.17.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../lib/jline-0.9.94.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../lib/audience-annotations-0.5.0.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../zookeeper-3.4.14.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../zookeeper-server/src/main/resources/lib/*.jar:/yinzhengjie/softwares/zookeeper-3.4.14/bin/../conf:
2019-04-19 10:22:52,912 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2019-04-19 10:22:52,912 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2019-04-19 10:22:52,912 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2019-04-19 10:22:52,912 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux
2019-04-19 10:22:52,912 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64
2019-04-19 10:22:52,912 [myid:] - INFO [main:Environment@100] - Client environment:os.version=3.10.0-957.el7.x86_64
2019-04-19 10:22:52,912 [myid:] - INFO [main:Environment@100] - Client environment:user.name=root
2019-04-19 10:22:52,912 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/root
2019-04-19 10:22:52,912 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/root
2019-04-19 10:22:52,913 [myid:] - INFO [main:ZooKeeper@442] - Initiating client connection, connectString=node103.yinzhengjie.org.cn:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@5ce65a89
Welcome to ZooKeeper!
2019-04-19 10:22:52,938 [myid:] - INFO [main-SendThread(node103.yinzhengjie.org.cn:2181):ClientCnxn$SendThread@1025] - Opening socket connection to server node103.yinzhengjie.org.cn/172.30.1.103:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2019-04-19 10:22:52,998 [myid:] - INFO [main-SendThread(node103.yinzhengjie.org.cn:2181):ClientCnxn$SendThread@879] - Socket connection established to node103.yinzhengjie.org.cn/172.30.1.103:2181, initiating session
[zk: node103.yinzhengjie.org.cn:2181(CONNECTING) 0] 2019-04-19 10:22:53,026 [myid:] - INFO [main-SendThread(node103.yinzhengjie.org.cn:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server node103.yinzhengjie.org.cn/172.30.1.103:2181, sessionid = 0x6700035fda3a0000, negotiated timeout = 30000 WATCHER:: WatchedEvent state:SyncConnected type:None path:null [zk: node103.yinzhengjie.org.cn:2181(CONNECTED) 0] ls /
[zookeeper,hadoop-ha]
[zk: node103.yinzhengjie.org.cn:2181(CONNECTED) 1]
[zk: node103.yinzhengjie.org.cn:2181(CONNECTED) 1] ls /
[zookeeper, yarn-leader-election, hadoop-ha, rmstore]
[zk: node103.yinzhengjie.org.cn:2181(CONNECTED) 2]
[zk: node103.yinzhengjie.org.cn:(CONNECTED) ] get /yarn-leader-election

cZxid = 0x300000008
ctime = Fri Apr :: CST
mZxid = 0x300000008
mtime = Fri Apr :: CST
pZxid = 0x300000009
cversion =
dataVersion =
aclVersion =
ephemeralOwner = 0x0
dataLength =
numChildren =
[zk: node103.yinzhengjie.org.cn:(CONNECTED) ]

[zk: node103.yinzhengjie.org.cn:2181(CONNECTED) 2] get /yarn-leader-election

[zk: node103.yinzhengjie.org.cn:(CONNECTED) ] ls /yarn-leader-election
[yinzhengjie-yarn]
[zk: node103.yinzhengjie.org.cn:(CONNECTED) ]

[zk: node103.yinzhengjie.org.cn:2181(CONNECTED) 3] ls /yarn-leader-election

[zk: node103.yinzhengjie.org.cn:(CONNECTED) ] ls /yarn-leader-election/yinzhengjie-yarn
[ActiveBreadCrumb, ActiveStandbyElectorLock]
[zk: node103.yinzhengjie.org.cn:(CONNECTED) ]

[zk: node103.yinzhengjie.org.cn:2181(CONNECTED) 4] ls /yarn-leader-election/yinzhengjie-yarn

[zk: node103.yinzhengjie.org.cn:(CONNECTED) ] get /yarn-leader-election/yinzhengjie-yarn/ActiveBreadCrumb       

yinzhengjie-yarnresourcemanager2
cZxid = 0x30000000b
ctime = Fri Apr :: CST
mZxid = 0x30000002c
mtime = Fri Apr :: CST
pZxid = 0x30000000b
cversion =
dataVersion =
aclVersion =
ephemeralOwner = 0x0
dataLength =
numChildren =
[zk: node103.yinzhengjie.org.cn:(CONNECTED) ]

[zk: node103.yinzhengjie.org.cn:2181(CONNECTED) 7] get /yarn-leader-election/yinzhengjie-yarn/ActiveBreadCrumb

[zk: node103.yinzhengjie.org.cn:(CONNECTED) ] get /yarn-leader-election/yinzhengjie-yarn/ActiveStandbyElectorLock

yinzhengjie-yarnresourcemanager2
cZxid = 0x30000002b
ctime = Fri Apr :: CST
mZxid = 0x30000002b
mtime = Fri Apr :: CST
pZxid = 0x30000002b
cversion =
dataVersion =
aclVersion =
ephemeralOwner = 0x660003eeeeb10001
dataLength =
numChildren =
[zk: node103.yinzhengjie.org.cn:(CONNECTED) ]

[zk: node103.yinzhengjie.org.cn:2181(CONNECTED) 8] get /yarn-leader-election/yinzhengjie-yarn/ActiveStandbyElectorLock

Apache Hadoop 2.9.2 的YARN High Available 模式部署的更多相关文章

  1. Apache Hadoop 2.9.2 的HDFS High Available模式部署

    Apache Hadoop 2.9.2 的HDFS High Available 模式部署 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 我们知道,当NameNode进程挂掉后,可 ...

  2. Apache Hadoop下一代MapReduce框架(YARN)简介 (Apache Hadoop NextGen MapReduce (YARN))

    英文看着头大,先试着翻译一下. E文原文:http://archive.cloudera.com/cdh5/cdh/5/hadoop/hadoop-yarn/hadoop-yarn-site/YARN ...

  3. kylin_异常_02_java.lang.NoClassDefFoundError: org/apache/hadoop/hive/conf/HiveConf 解决办法

    一.异常现象 在kylin的web管理界面,设置hive数据源时,报错: 查找kylin的日志时发现,弹出提示框的原因是因为出现错误: ERROR [http-bio-7070-exec-10] co ...

  4. hadoop错误org.apache.hadoop.yarn.exceptions.YarnException Unauthorized request to start container

    错误: 14/04/29 02:45:07 INFO mapreduce.Job: Job job_1398704073313_0021 failed with state FAILED due to ...

  5. Apache Hadoop YARN: 背景及概述

    从2012年8月开始Apache Hadoop YARN(YARN = Yet Another Resource Negotiator)成了Apache Hadoop的一项子工程.自此Apache H ...

  6. Apache Hadoop集群安装(NameNode HA + YARN HA + SPARK + 机架感知)

    1.主机规划 序号 主机名 IP地址 角色 1 nn-1 192.168.9.21 NameNode.mr-jobhistory.zookeeper.JournalNode 2 nn-2 192.16 ...

  7. Apache hadoop namenode ha和yarn ha ---HDFS高可用性

    HDFS高可用性Hadoop HDFS 的两大问题:NameNode单点:虽然有StandbyNameNode,但是冷备方案,达不到高可用--阶段性的合并edits和fsimage,以缩短集群启动的时 ...

  8. Apache Hadoop集群离线安装部署(二)——Spark-2.1.0 on Yarn安装

    Apache Hadoop集群离线安装部署(一)——Hadoop(HDFS.YARN.MR)安装:http://www.cnblogs.com/pojishou/p/6366542.html Apac ...

  9. Apache Hadoop集群离线安装部署(一)——Hadoop(HDFS、YARN、MR)安装

    虽然我已经装了个Cloudera的CDH集群(教程详见:http://www.cnblogs.com/pojishou/p/6267616.html),但实在太吃内存了,而且给定的组件版本是不可选的, ...

随机推荐

  1. 生鲜配送管理系统_升鲜宝V2.0 供应商协同系统设计思想及设计效果展现(一)

    生鲜配送管理系统[升鲜宝]V2.0 供应商协同系统小程序设计思想及操作说明(一)     生鲜供应链企业,最重要的二个方面,其中一个是客户服务(销售订单)    另外一个就是供应商的管控,只有做好了这 ...

  2. vue input输入框长度限制

    今天在开发登录页时,需要设置登录输入框的长度,输入类型为number <input type="number" maxlength="11" placeh ...

  3. idea Maven项目找不到相关依赖包(红色波浪线)

    前两天做项目的时候,把团队其他人的代码从git同步到自己电脑上,出现了冲突.发现是maven依赖出现了问题,之前的截图找不到了,我就简单描述一下.就是下图箭头所示位置出现了红色波浪线. 在网上找了很多 ...

  4. kali权限提升之本地提权

    kali权限提升之本地提权 系统账号之间权限隔离 操作系统的安全基础 用户空间 内核空间 系统账号: 用户账号登陆时候获取权限令牌 服务账号无需用户登录已在后台启动服务 windows用户全权限划分: ...

  5. UEditor1.2.6.0在.net环境下使用

    UEditor1.2.6.0 1.百度百科词条 2.UEditor官方网站 [CKEditor+CKFinder的配置实用,可查看博主另一篇文章] 第一次接触UEditor还是在2011年的下半年里, ...

  6. 服务消费者Feign和Ribbon的区别

    1.Ribbon通过注解@EnableEurekaClient/@EnableDiscoveryClient向服务中心注册:    PS:选用的注册中心是eureka,那么就推荐@EnableEure ...

  7. Mysql 字符串指定位置插入空格

    UPDATE flow_data_243 SET data_15=CONCAT(LEFT(data_15,10),' ',RIGHT(data_15,LENGTH(data_15)-10)) WHER ...

  8. Linux Docker的部署

    1.安装 $ yum -y install docker 2.启动docker服务 $ systemctl start docker 3.设置开启自启 $ systemctl enable docke ...

  9. 教程一 openwrt路由器入门 远程命令行+文件系统

    如图,拿到一个openwrt路由器我们第一步要远程控制. 这里在买了两块wifi-robots  wifi视频模块. 0首先说下这个WIIF的信息 淘宝购买链接 https://item.taobao ...

  10. 解决mySQL数据库锁表问题。

    先用这条命令查询数据库阻塞的进程 SELECT * FROM information_schema.innodb_trx 找到后在根据下图这个字段:try_mysql_thread_id 作为这条数据 ...