阿里云ECS异常重启后(因为受到攻击),Hbase出现Master is initializing问题:
root@iZ2ze77za5f39z5j0xexocZ:~# hbase shell
2023-03-22 10:01:04,349 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.4.16, rd1714710877653691e2125bd94b68a5b484a3a06, Wed Feb 1 09:46:35 UTC 2023
Took 0.0032 seconds
hbase:001:0> list_namespace
list_namespace list_namespace_tables
hbase:001:0> list_namespace
NAMESPACE
ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing
at org.apache.hadoop.hbase.master.HMaster.checkInitialized(HMaster.java:2823)
at org.apache.hadoop.hbase.master.HMaster.listNamespaces(HMaster.java:3125)
at org.apache.hadoop.hbase.master.MasterRpcServices.listNamespaces(MasterRpcServices.java:1017)
at org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:387)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:132)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:369)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:349)
For usage try 'help "list_namespace"'
Took 10.7576 seconds
hbase:002:0> quit
root@iZ2ze77za5f39z5j0xexocZ:~# stop-hbase.sh
解决步骤:
关闭hbase,如果关闭失败,手动关闭hbase相关进程。
root@iZ2ze77za5f39z5j0xexocZ:~# stop-hbase.sh
no hbase master found
用zookeeper命令行客户端删除/hbase,根据zookeeper版本不同,选择使用rmr或者deleteall
root@iZ2ze77za5f39z5j0xexocZ:~/test# zkCli.sh
ls /
[zookeeper, hbase]
rmr /hbase
ls /
[zookeeper]
quit
hdfs 删除hbase节点,如果有重要数据需要提前备份
hdfs dfs -rm -r /hbase
重新启动hbase
start-hbase.sh
用hbase shell查看namespace,正常
root@iZ2ze77za5f39z5j0xexocZ:~# hbase shell
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.4.16, rd1714710877653691e2125bd94b68a5b484a3a06, Wed Feb 1 09:46:35 UTC 2023
Took 0.0057 seconds
hbase:001:0> list_namespace
NAMESPACE
default
hbase
2 row(s)
Took 1.1131 seconds