设为首页 加入收藏

TOP

Hadoop HA——hdfs haadmin 详解
2019-05-09 00:20:45 】 浏览:127
Tags:Hadoop hdfs haadmin 详解
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/W1331808514/article/details/86484246
  • NameNode切换

Hadoop版本:hadoop-2.6.0-CDH5.5.4

namenode切换需要用到hdfs haadmin 命令,该命令有如下方法:

hdfs haadmin -transitionToActive <serviceId> 将<serviceId>namenode过渡到active状态

当前状态: nn1:standby nn2:active

执行hdfs haadmin -transitionToActive -forcemanual nn1 将nn1过渡为Active状态,

报出以下信息,提示nn2已经为active状态

19/01/11 11:31:01 WARN ha.HAAdmin: Proceeding with manual HA state management even though

automatic failover is enabled for NameNode at e3base04/192.168.1.131:12001

transitionToActive: Node nn2 is already active

Usage: HAAdmin [-transitionToActive <serviceId> [--forceactive]]

再次查看两个namenode状态,两个namenode节点状态并没有变化。

执行hdfs haadmin -transitionToActive -forcemanual nn2 将nn2过渡为Active状态,

报出以下信息:

19/01/11 11:44:04 WARN ha.HAAdmin: Proceeding with manual HA state management even though

automatic failover is enabled for NameNode at e3base03/192.168.1.130:12001

19/01/11 11:44:05 WARN ha.HAAdmin: Proceeding with manual HA state management even though

automatic failover is enabled for NameNode at e3base04/192.168.1.131:12001

没有明显报错,再次查看两个namenode状态,两个namenode节点状态并没有变化。

综合以上情况:当active节点正常时,使用hdfs haadmin -transitionToActive命令对两个namenode节点切换都不起作用.

hdfs haadmin -transitionToStandby <serviceId>

将<serviceId>namenode过渡到standby状态

当前状态: nn1:standby nn2:active

执行hdfs haadmin -transitionToStandby -forcemanual nn1 将nn1过渡到standby状态:

报出以下信息:

19/01/11 13:56:18 WARN ha.HAAdmin: Proceeding with manual HA state management even though

automatic failover is enabled for NameNode at e3base03/192.168.1.130:12001

两个namenode状态并没有变化:

执行hdfs haadmin -transitionToStandby -forcemanual nn2 将nn2过渡到standby状态:

报出以下信息:

19/01/11 14:07:59 WARN ha.HAAdmin: Proceeding with manual HA state management even though

automatic failover is enabled for NameNode at e3base04/192.168.1.131:12001

两个namenode状态发生变化:

综合以上情况:当active节点正常时,执行hdfs haadmin -transitionToStandby命令可以将active的namenode节点转换成standby状态。

hdfs haadmin [-failover [--forcefence] [--forceactive] <serviceId> <serviceId>]

在两个namenode节点之间进行故障转移,例:

当前namenode状态: nn1:active nn2:standby

hdfs haadmin -failover -forcefence -forceactive nn1 nn2,表示将nn2设置成active状态。

报出以下信息:

[e3base@e3base03 e3base]$ hdfs haadmin -failover -forcefence -forceactive nn1 nn2

forcefence and forceactive flags not supported with auto-failover enabled.

这句话表示,配置了自动切换之后,就不能进行手动切换了,故此次切换失败。

dfs.ha.automatic-failover.enabled参数需要在hdfs-site.xml或者core-site.xml中添加。

将nn1和nn2调换,执行hdfs haadmin -failover -forcefence -forceactive nn2 nn1,

以及强制手动执行:hdfs haadmin -failover -forcefence -forceactive -forcemanual nn1 nn2

也是同样的结果。

将2台namenode节点中的hdfs-site.xml中的dfs.ha.automatic-failover.enabled参数值改为false后(不需要重启namenode进程),再次执行hdfs haadmin -failover -forcefence -forceactive nn1 nn2,

从日志中可以看到在进行故障转移时,采用了第一个故障转移方法:ssh方法,该方法原理是ssh到出现故障的主机,并将namenode进程kill掉。(第二个为shell方法:运行任何的shell命令去过滤active状态的namenode)

综上:hdfs haadmin [-failover [--forcefence] [--forceactive] <serviceId> <serviceId>]命令在配置故障自动切换(dfs.ha.automatic-failover.enabled=true)之后,无法手动进行。可将该参数更改为false(不需要重启进程)后,重新执行该命令即可。

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇实时计算Flink > 独享模式 >.. 下一篇局域网下连接其他电脑的HDFS集群

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目