HA模式手动切换namenode状态

查看状态

  hdfs haadmin -getServiceState nn1

有时候通过网页访问两个namenode的http-address,看到默认的主namenode状态变成了standy,这时可以通过下面命令来实现主namenode的状态切换成active。

  hdfs  haadmin -failover -forcefence -forceactive  nn2  nn1

  或者

    hdfs haadmin -transitionToActive nn1
      hdfs haadmin -transitionToActive --forcemanual nn1

注意:此处“nn2  nn1”的顺序表示active状态由nn2转换到nn1上、

注意,如果你配置了

  dfs.ha.automatic-failover.enabled

自动切换,就不能手动切换了,否则会报如下异常: 

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

hdfs haadmin -transitionToActive --forcemanual --forceactive nn2 

https://www.cnblogs.com/hxsyl/p/6039466.html

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

https://www.cnblogs.com/xyliao/p/5752018.html

原文地址:https://www.cnblogs.com/0xcafedaddy/p/8257827.html