Hadoop2.7实战v1.0之YARN HA

简介: YARN HA实战v1.0 当前环境:hadoop+zookeeper(namenode,resourcemanager HA)                  resourcemanager ...

YARN HA实战v1.0

当前环境:hadoop+zookeeper(namenode,resourcemanager HA)   

              resourcemanager

serviceId

init status

sht-sgmhadoopnn-01

rm1

active

sht-sgmhadoopnn-02

rm2

standby

参考:
http://blog.csdn.net/u011414200/article/details/50336735

http://blog.csdn.net/u011414200/article/details/50276257

.查看resourcemanageractive还是standby

1.打开网页

http://172.16.101.55:8088/cluster/cluster

http://172.16.101.56:8088/cluster/cluster

 

2.查看resourcemanager日志

点击(此处)折叠或打开

  1. [root@sht-sgmhadoopnn-01 logs]# more yarn-root-resourcemanager-sht-sgmhadoopnn-01.telenav.cn.log
  2. …………………..
  3. 2016-03-03 18:10:01,289 INFO org.apache.hadoop.yarn.server.resourcemanager.ResourceManager: Transitioned to active state

点击(此处)折叠或打开

  1. [root@sht-sgmhadoopnn-02 logs]# more yarn-root-resourcemanager-sht-sgmhadoopnn-02.telenav.cn.log
  2. …………………..
  3. 2016-03-03 18:10:34,250 INFO org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher: YARN system metrics publishing service is not enabled
  4. 2016-03-03 18:10:34,250 INFO org.apache.hadoop.yarn.server.resourcemanager.ResourceManager: Transitioning to standby state

3. yarn rmadmin –getServiceState 


点击(此处)折叠或打开

  1. ###$HADOOP_HOME/etc/hadoop/yarn-site.xml
  2.               <property>
  3.         <name>yarn.resourcemanager.ha.rm-ids</name>
  4.         <value>rm1,rm2</value>
  5.     </property>


  6. [root@sht-sgmhadoopnn-02 logs]# yarn rmadmin -getServiceState rm1
  7. active
  8. [root@sht-sgmhadoopnn-02 logs]# yarn rmadmin -getServiceState rm2
  9. standby
. 命令

点击(此处)折叠或打开

  1. [root@sht-sgmhadoopnn-01 bin]# yarn --help
  2. Usage: yarn [--config confdir] [COMMAND | CLASSNAME]
  3.   CLASSNAME run the class named CLASSNAME
  4.  or
  5.   where COMMAND is one of:
  6.   resourcemanager -format-state-store deletes the RMStateStore
  7.   resourcemanager run the ResourceManager
  8.   nodemanager run a nodemanager on each slave
  9.   timelineserver run the timeline server
  10.   rmadmin admin tools
  11.   sharedcachemanager run the SharedCacheManager daemon
  12.   scmadmin SharedCacheManager admin tools
  13.   version print the version
  14.   jar <jar> run a jar file
  15.   application prints application(s)
  16.                                         report/kill application
  17.   applicationattempt prints applicationattempt(s)
  18.                                         report
  19.   container prints container(s) report
  20.   node prints node report(s)
  21.   queue prints queue information
  22.   logs dump container logs
  23.   classpath prints the class path needed to
  24.                                         get the Hadoop jar and the
  25.                                         required libraries
  26.   cluster prints cluster information
  27.   daemonlog get/set the log level for each
  28.                                         daemon

  29. ###########################################################################
  30. [root@sht-sgmhadoopnn-01 bin]# yarn rmadmin --help
  31. -help: Unknown command
  32. Usage: yarn rmadmin
  33.    -refreshQueues
  34.    -refreshNodes
  35.    -refreshSuperUserGroupsConfiguration
  36.    -refreshUserToGroupsMappings
  37.    -refreshAdminAcls
  38.    -refreshServiceAcl
  39.    -getGroups [username]
  40.    -addToClusterNodeLabels [label1,label2,label3] (label splitted by ",")
  41.    -removeFromClusterNodeLabels [label1,label2,label3] (label splitted by ",")
  42.    -replaceLabelsOnNode [node1[:port]=label1,label2 node2[:port]=label1,label2]
  43.    -directlyAccessNodeLabelStore
  44.    -transitionToActive [--forceactive] <serviceId>
  45.    -transitionToStandby <serviceId>
  46.    -failover [--forcefence] [--forceactive] <serviceId> <serviceId>
  47.    -getServiceState <serviceId>
  48.    -checkHealth <serviceId>
  49.    -help [cmd]
transitionToActive transitionToStandby 是用于在不同状态之间切换的。

failover 初始化一个故障恢复。该命令会从一个失效的resourcemanager切换到另一个上面(不支持在自动切换的环境操作)

getServiceState 获取当前resourcemanager的状态。

checkHealth 检查resourcemanager的状态。正常就返回0,否则返回非0值。

.实验

1.测试YARN的手工切换功能(失败)

点击(此处)折叠或打开

  1. [root@sht-sgmhadoopnn-01 ~]# yarn rmadmin -failover --forceactive rm1 rm2
  2. forcefence and forceactive flags not supported with auto-failover enabled.

#yarn-site.xml 中设置yarn.resourcemanager.ha.automatic-failover.enabled true,故提示不能手动切换

2.测试YARN的自动切换功能(成功)

 a.active resoucemanager机器上通过jps命令查找到resoucemanager的进程号,然后通过kill -9的方式杀掉进程,观察另一个resoucemanager节点是否会从状态standby变成active状态

点击(此处)折叠或打开

  1. [root@sht-sgmhadoopnn-01 ~]# yarn rmadmin -getServiceState rm1
  2. active
  3. [root@sht-sgmhadoopnn-01 ~]# yarn rmadmin -getServiceState rm2
  4. standby

  5. [root@sht-sgmhadoopnn-01 bin]# jps
  6. 2583 Jps
  7. 10162 DFSZKFailoverController
  8. 28432 ResourceManager
  9. 21679 NameNode

  10. [root@sht-sgmhadoopnn-01 ~]# kill -9 28432

  11. [root@sht-sgmhadoopnn-02 bin]# jps
  12. 19147 ResourceManager
  13. 17837 NameNode
  14. 17970 DFSZKFailoverController
  15. 27330 Jps


  16. [root@sht-sgmhadoopnn-01 bin]# yarn rmadmin -getServiceState rm1
  17. 16/03/03 19:23:39 INFO ipc.Client: Retrying connect to server: sht-sgmhadoopnn-01/172.16.101.55:8033. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=1, sleepTime=1000 MILLISECONDS)
  18. Operation failed: Call From sht-sgmhadoopnn-01.telenav.cn/172.16.101.55 to sht-sgmhadoopnn-01:8033 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused



  19. [root@sht-sgmhadoopnn-01 bin]# yarn rmadmin -getServiceState rm2
  20. active
  21. [root@sht-sgmhadoopnn-01 bin]#

#### sht-sgmhadoopnn-01 机器上resourcemanager进程已经起来,且状态为standby

  c. 再次切换

点击(此处)折叠或打开

  1. [root@sht-sgmhadoopnn-01 sbin]# yarn rmadmin -transitionToStandby rm2
  2. Automatic failover is enabled for org.apache.hadoop.yarn.client.RMHAServiceTarget@11f69937
  3. Refusing to manually manage HA state, since it may cause
  4. a split-brain scenario or other incorrect state.
  5. If you are very sure you know what you are doing, please
  6. specify the --forcemanual flag.

  7. [root@sht-sgmhadoopnn-01 sbin]# yarn rmadmin -transitionToStandby --forcemanual rm2
  8. You have specified the --forcemanual flag. This flag is dangerous, as it can induce a split-brain scenario that WILL CORRUPT your HDFS namespace, possibly irrecoverably.

  9. It is recommended not to use this flag, but instead to shut down the cluster and disable automatic failover if you prefer to manually manage your HA state.

  10. You may abort safely by answering 'n' or hitting ^C now.

  11. Are you sure you want to continue? (Y or N) Y
  12. 16/03/03 19:29:36 WARN ha.HAAdmin: Proceeding with manual HA state management even though
  13. automatic failover is enabled for org.apache.hadoop.yarn.client.RMHAServiceTarget@4e33967b


  14. [root@sht-sgmhadoopnn-01 sbin]# yarn rmadmin -getServiceState rm1
  15. standby
  16. [root@sht-sgmhadoopnn-01 sbin]# yarn rmadmin -getServiceState rm2
  17. standby

  18. [root@sht-sgmhadoopnn-01 sbin]# yarn rmadmin -transitionToActive rm1
  19. Automatic failover is enabled for org.apache.hadoop.yarn.client.RMHAServiceTarget@54c4f317
  20. Refusing to manually manage HA state, since it may cause
  21. a split-brain scenario or other incorrect state.
  22. If you are very sure you know what you are doing, please
  23. specify the --forcemanual flag.

  24. [root@sht-sgmhadoopnn-01 sbin]# yarn rmadmin -transitionToActive --forcemanual rm1
  25. You have specified the --forcemanual flag. This flag is dangerous, as it can induce a split-brain scenario that WILL CORRUPT your HDFS namespace, possibly irrecoverably.

  26. It is recommended not to use this flag, but instead to shut down the cluster and disable automatic failover if you prefer to manually manage your HA state.

  27. You may abort safely by answering 'n' or hitting ^C now.

  28. Are you sure you want to continue? (Y or N) Y
  29. 16/03/03 19:32:46 WARN ha.HAAdmin: Proceeding with manual HA state management even though
  30. automatic failover is enabled for org.apache.hadoop.yarn.client.RMHAServiceTarget@54c4f317

  31.  [root@sht-sgmhadoopnn-01 sbin]# yarn rmadmin -getServiceState rm1
  32. 16/03/03 19:32:55 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  33. active
  34. [root@sht-sgmhadoopnn-01 sbin]# yarn rmadmin -getServiceState rm2
  35. 16/03/03 19:33:02 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  36. standby
  37. [root@sht-sgmhadoopnn-01 sbin]#

#HDFS HA切换实验不一样, -transitionToStandby,会自动将standby—>active,active-->standby;

YARN HA就不一样,需要还有手动再执行一下-transitionToActive.

目录
相关文章
|
1月前
|
分布式计算 资源调度 Hadoop
【赵渝强老师】基于ZooKeeper实现Hadoop HA
本文介绍了如何在4个节点(bigdata112、bigdata113、bigdata114和bigdata115)上部署HDFS高可用(HA)架构,并同时部署Yarn的HA。详细步骤包括环境变量设置、配置文件修改、ZooKeeper集群启动、JournalNode启动、HDFS格式化、ZooKeeper格式化以及启动Hadoop集群等。最后通过jps命令检查各节点上的后台进程,确保部署成功。
|
2月前
|
存储 分布式计算 资源调度
大数据-04-Hadoop集群 集群群起 NameNode/DataNode启动 3台公网云 ResourceManager Yarn HDFS 集群启动 UI可视化查看 YarnUI(一)
大数据-04-Hadoop集群 集群群起 NameNode/DataNode启动 3台公网云 ResourceManager Yarn HDFS 集群启动 UI可视化查看 YarnUI(一)
80 5
|
2月前
|
资源调度 数据可视化 大数据
大数据-04-Hadoop集群 集群群起 NameNode/DataNode启动 3台公网云 ResourceManager Yarn HDFS 集群启动 UI可视化查看 YarnUI(二)
大数据-04-Hadoop集群 集群群起 NameNode/DataNode启动 3台公网云 ResourceManager Yarn HDFS 集群启动 UI可视化查看 YarnUI(二)
37 4
|
2月前
|
XML 分布式计算 资源调度
大数据-02-Hadoop集群 XML配置 超详细 core-site.xml hdfs-site.xml 3节点云服务器 2C4G HDFS Yarn MapRedece(一)
大数据-02-Hadoop集群 XML配置 超详细 core-site.xml hdfs-site.xml 3节点云服务器 2C4G HDFS Yarn MapRedece(一)
171 5
|
2月前
Hadoop-09-HDFS集群 JavaClient 代码上手实战!详细附代码 安装依赖 上传下载文件 扫描列表 PUT GET 进度条显示(二)
Hadoop-09-HDFS集群 JavaClient 代码上手实战!详细附代码 安装依赖 上传下载文件 扫描列表 PUT GET 进度条显示(二)
45 3
|
2月前
|
XML 资源调度 网络协议
大数据-02-Hadoop集群 XML配置 超详细 core-site.xml hdfs-site.xml 3节点云服务器 2C4G HDFS Yarn MapRedece(二)
大数据-02-Hadoop集群 XML配置 超详细 core-site.xml hdfs-site.xml 3节点云服务器 2C4G HDFS Yarn MapRedece(二)
126 4
|
2月前
|
分布式计算 资源调度 Hadoop
大数据-01-基础环境搭建 超详细 Hadoop Java 环境变量 3节点云服务器 2C4G XML 集群配置 HDFS Yarn MapRedece
大数据-01-基础环境搭建 超详细 Hadoop Java 环境变量 3节点云服务器 2C4G XML 集群配置 HDFS Yarn MapRedece
84 4
|
2月前
|
分布式计算 Java Hadoop
Hadoop-09-HDFS集群 JavaClient 代码上手实战!详细附代码 安装依赖 上传下载文件 扫描列表 PUT GET 进度条显示(一)
Hadoop-09-HDFS集群 JavaClient 代码上手实战!详细附代码 安装依赖 上传下载文件 扫描列表 PUT GET 进度条显示(一)
41 2
|
3月前
|
分布式计算 Hadoop Devops
Hadoop集群配置https实战案例
本文提供了一个实战案例,详细介绍了如何在Hadoop集群中配置HTTPS,包括生成私钥和证书文件、配置keystore和truststore、修改hdfs-site.xml和ssl-client.xml文件,以及重启Hadoop集群的步骤,并提供了一些常见问题的故障排除方法。
86 3
Hadoop集群配置https实战案例
|
3月前
|
分布式计算 资源调度 Hadoop
Hadoop YARN资源管理-容量调度器(Yahoo!的Capacity Scheduler)
详细讲解了Hadoop YARN资源管理中的容量调度器(Yahoo!的Capacity Scheduler),包括队列和子队列的概念、Apache Hadoop的容量调度器默认队列、队列的命名规则、分层队列、容量保证、队列弹性、容量调度器的元素、集群如何分配资源、限制用户容量、限制应用程序数量、抢占申请、启用容量调度器以及队列状态管理等方面的内容。
91 3

相关实验场景

更多