又是码字的一天,今天在做Hadoop项目的时候发现了这样的一个问题,问题如下图所示。
这个Operation category READ is not supported in state standby中文翻译为在待机状态下不支持读取操作类别,原因就是你的Hadoop长时间没有运行,虚拟机息屏会自动将Hadoop切换为待机状态,原理和window系统的待机是同样的原理。所以只需要将虚拟机的Hadoop中的ServicesState的nn1由原来的standby模式切换为active模式,将nn2中的active模式切换为standby模式就可以了。
bin/hdfs haadmin -getServiceState nn1
待机状态下nn1显示为standby
bin/hdfs haadmin -getServiceState nn2
待机状态下nn2显示为active
通过如下命令将nn1、nn2进行切换就可以了
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
21/12/05 19:03:15 WARN ha.HAAdmin: Proceeding with manual HA state management even though automatic failover is enabled for NameNode at hadoop02/192.168.121.135:9000
transitionToActive: Node nn1 is already active.此时nn1就切换为active。
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
21/12/05 19:03:52 WARN ha.HAAdmin: Proceeding with manual HA state management even though
automatic failover is enabled for NameNode at hadoop02/192.168.121.135:9000
这样就完成了!!!!
这次的学习笔记分享就到这里了,下期再见!