Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
sarah@hadoop102 hadoop]$ hadoop fs -ls /
2023-06-29 08:09:29,024 INFO retry.RetryInvocationHandler: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
at org.apache.hadoop.hdfs.server.namenode.ha.StandbyState.checkOperation(StandbyState.java:98)
at org.apache.hadoop.hdfs.server.namenode.NameNode$NameNodeHAContext.checkOperation(NameNode.java:2017)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkOperation(FSNamesystem.java:1441)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(FSNamesystem.java:3125)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getFileInfo(NameNodeRpcServer.java:1173)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getFileInfo(ClientNamenodeProtocolServerSideTranslatorPB.java:973)
at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:527)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1036)
at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:1000)
at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:928)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2916)
, while invoking ClientNamenodeProtocolTranslatorPB.getFileInfo over hadoop103/172.16.11.xxx:8020 after 1 failover attempts. Trying to failover after sleeping for 1075ms.
Found 12 items
drwxr-xr-x - sarah supergroup 0 2023-06-29 07:55 /ab
ds
已经配置Hadoop ha,但是依旧会报Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error,这个问题其实卡了很久,也不知道该如何解决,我看的是报active不是hadoop103,所以就把hadoop102和Hadoop104上的namenode给kill掉了,让hadoop103成为activte,在xshell中式不报错的,但是在ds中还是会报这个错误,然后我再重启了hdfs,发现这次的active是hadoop102,但是在xshell和ds中都不会报错误了,我也不知道是什么原理
现在试试将active变化hadoop104看看,会不会报错
经过实验,依旧报错:
[sarah@hadoop104 hdfswriter]$ hdfs haadmin -getServiceState nn3
active
[sarah@hadoop104 hdfswriter]$ hadoop fs -ls /
2023-06-29 09:05:44,925 INFO retry.RetryInvocationHandler: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
at org.apache.hadoop.hdfs.server.namenode.ha.StandbyState.checkOperation(StandbyState.java:98)
at org.apache.hadoop.hdfs.server.namenode.NameNode$NameNodeHAContext.checkOperation(NameNode.java:2017)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkOperation(FSNamesystem.java:1441)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(FSNamesystem.java:3125)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getFileInfo(NameNodeRpcServer.java:1173)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getFileInfo(ClientNamenodeProtocolServerSideTranslatorPB.java:973)
at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:527)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1036)
at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:1000)
at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:928)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2916)
, while invoking ClientNamenodeProtocolTranslatorPB.getFileInfo over hadoop103/172.16.11.155:8020 after 1 failover attempts. Trying to failover after sleeping for 1360ms.
已经配置了判断哪个namenode是active,但是这个配置在ds中只对hadoop102生效,在xshell中对hadoop102和hadoop103生效,也不知道是什么原因
<!--配置一个HA失败转移的java类,client使用它判断哪个节点是激活态-->
<property>
<name>dfs.client.failover.proxy.provider.hadoop-test-cluster</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
在生产环境中,我是只配置了两个namenode,就不会有这样的情况,不知道是不是由于配置了超过两个namenode的情况
总结
ds的worker是在hadoop104上,使用默认的worker分组,但是每次随机都是hadoop104,也不知道是为什么,如果namenode是hadoop103,那么xhell中式不会报错的,但是ds中会,如果namenode式在hadoop104,xshell和ds都会报错,如果是hadoop102都不会报错,具体原因还不知道