查看节点状态
#查看节点状态 [root@hadoop1 bin]# hdfs haadmin -getServiceState nn1 standby [root@hadoop1 bin]# hdfs haadmin -getServiceState nn2 active [root@hadoop1 bin]# pwd /root/tools/hadoop/tools/hadoop/bin
将 NN2 切换为 Standby 备用节点
hdfs haadmin -transitionToStandby --forcemanual nn2
将 NN1 切换为 Active 备用节点
hdfs haadmin -transitionToActive --forcemanual nn1
[root@hadoop1 bin]# hdfs haadmin -transitionToStandby --forcemanual nn2 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. 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. You may abort safely by answering 'n' or hitting ^C now. Are you sure you want to continue? (Y or N) Y 23/04/19 17:19:02 WARN ha.HAAdmin: Proceeding with manual HA state management even though automatic failover is enabled for NameNode at hadoop2/192.168.1.202:9000 [root@hadoop1 bin]# hdfs haadmin -getServiceState nn2 standby [root@hadoop1 bin]# hdfs haadmin -transitionToActive --forcemanual nn1 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. 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. You may abort safely by answering 'n' or hitting ^C now. Are you sure you want to continue? (Y or N) Y 23/04/19 17:20:35 WARN ha.HAAdmin: Proceeding with manual HA state management even though automatic failover is enabled for NameNode at hadoop2/192.168.1.202:9000 23/04/19 17:20:35 WARN ha.HAAdmin: Proceeding with manual HA state management even though automatic failover is enabled for NameNode at hadoop1/192.168.1.201:9000
切换后的状态及效果图
[root@hadoop1 bin]# hdfs haadmin -getServiceState nn2 standby [root@hadoop1 bin]# hdfs haadmin -getServiceState nn1 active
标签:bin,hdfs,--,haadmin,Hadoop,集群,hadoop1,主备,root From: https://www.cnblogs.com/yappleorange/p/17334057.html