Hadoop集群手动主备切换

 查看节点状态

#查看节点状态
[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

 

posted @   yappleorange  阅读(232)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示