HADOOP HA 报错 - 所有 namenode 都是standby --集群报错: Operation category READ is not supported in state standby

时间:2022-02-23 20:49:56

报错:

HADOOP HA 报错 - 所有 namenode 都是standby --集群报错: Operation category READ is not supported in state standby

经过查看集群的jps如下:

==================== hadoop01 jps ===================
FsShell
ResourceManager
NameNode
Jps
==================== hadoop02 jps ===================
NodeManager
DataNode
JournalNode
QuorumPeerMain
Jps
==================== hadoop03 jps ===================
NodeManager
DataNode
JournalNode
QuorumPeerMain
Jps
==================== hadoop04 jps ===================
JournalNode
QuorumPeerMain
Jps
NodeManager
DataNode
==================== hadoop05 jps ===================
Jps
NameNode

查看日志:

HADOOP HA 报错 - 所有 namenode 都是standby --集群报错: Operation category READ is not supported in state standby

状况:

所有namenode都是standby,即ZK服务未生效

尝试一:手动强制转化某个namenode为active

操作:在某台namenode上,执行 hdfs haadmin -transitionToActive --forcemanual nn1 (nn1是你的某台nameservice-id)

结果:nn1被成功转为active。但是在stop-dfs.sh后再一次start-dfs.sh后,所有namenode仍然都是standby

结论:果然因该是ZK的问题

尝试二:初始化ZK

操作:在某台namenode上,执行 hdfs zkfc -formatZK

HADOOP HA 报错 - 所有 namenode 都是standby --集群报错: Operation category READ is not supported in state standby

结果:重新 start-dfs.sh后,一切正常

NOTE: Zk初始化必须要启动ZK,否则报错

HADOOP HA 报错 - 所有 namenode 都是standby --集群报错: Operation category READ is not supported in state standby

HADOOP HA 报错 - 所有 namenode 都是standby --集群报错: Operation category READ is not supported in state standby