其他分享
首页 > 其他分享> > 启动HBase报错master.HMaster: Failed to become active master的解决方法

启动HBase报错master.HMaster: Failed to become active master的解决方法

作者:互联网

情况:

已启动ZooKeeper和HDFS,再启动HBase,虽然启动成功,但过了几秒后HBase自动关闭了,并报错。

 

完整的报错信息:

master.HMaster: Failed to become active master
org.apache.hadoop.hbase.util.FileSystemVersionException: HBase file layout needs to be upgraded. You have version null and I want version 8. 
Consult http://hbase.apache.org/book.html for further information about upgrading HBase. Is your hbase.rootdir valid? If so, you may need to run 'hbase hbck -fixVersionFile'.

 

解决方法:

#登入hdfs用户
su hdfs

#删除/hbase/data目录
hadoop fs -rmr /apps/hbase/data  #旧版
hdfs dfs -rm -r /apps/hbase/data  #新版

#登入ZooKeeper
zkCli.sh

#查看是否存在/hbase-unsecure目录
ls /

#删除/hbase-unsecure目录
rmr /hbase-unsecure  #旧版
deleteall /hbase-unsecure  #新版

最后重启HBase即可

 

附:

如果执行了报错信息中的命令:

hbase hbck -fixVersionFile

则会报出新的错误,说apps/hbase/data/.tmp/hbase-hbck.lock文件被占用了,需要先删除该锁文件

删除命令:

hdfs dfs -rm /apps/hbase/data/.tmp/hbase-hbck.lock

 

标签:hdfs,hbck,HMaster,报错,master,hbase,data,HBase
来源: https://www.cnblogs.com/live41/p/15773531.html