HDFS查看异常:Operation category READ is not supported in state standby. Visit

 跨集群访问hdfs失败

$ hdfs dfs -ls hdfs://test:8020/hbase
ls: Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error

意思是namenode不可用,查看namenode状态

hdfs-site.xml
  
    dfs.ha.namenodes.nameservice1
    namenode223,namenode47
  

使用命令查看namenode状态,发现主NameNode是在运行的。

$hdfs haadmin -getServiceState namenode223                        
active

此时如果查看namenode是standby模式可以使用以下命令前置切换主备 

hdfs haadmin -transitionToActive --forcemanual namenode47

 

找了半天才发现test:8020是之前的namenode,后来NameNode被我迁移了,换成test2:8020,ok。

总结几个命令,日常维护时使用:

#切换NameNode(强制切换主备),前提是目前在用的NameNode是standby状态,否则失败
hdfs haadmin -transitionToActive --forcemanual namenode47

#查看NameNode运行状态
hdfs haadmin -getServiceState namenode223              

更多查看
$ hdfs haadmin -help
Usage: DFSHAAdmin [-ns ]
    [-transitionToActive  [--forceactive]]
    [-transitionToStandby ]
    [-failover [--forcefence] [--forceactive]  ]
    [-getServiceState ]
    [-checkHealth ]
    [-help ]

Generic options supported are
-conf      specify an application configuration file
-D             use value for given property
-fs       specify a namenode
-jt     specify a ResourceManager
-files     specify comma separated files to be copied to the map reduce cluster
-libjars     specify comma separated jar files to include in the classpath.
-archives     specify comma separated archives to be unarchived on the compute machines.

The general command line syntax is
bin/hadoop command [genericOptions] [commandOptions]

 

你可能感兴趣的:(HDFS,Hadoop生态系统个人总结,Operation,category,READ,HDFS异常)