[Solved] HBase Startup Error: master.HMaster: Failed to become active master

situation:

Zookeeper and HDFS have been started, and then HBase has been started. Although the startup is successful, HBase automatically shuts down after a few seconds, and an error is reported.

Complete error reporting information:

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'.

Solution:

#Login to hdfs user
su hdfs

#delete the /hbase/data directory
hadoop fs -rmr /apps/hbase/data #Older version
hdfs dfs -rm -r /apps/hbase/data #newer

#login to ZooKeeper
zkCli.sh

#Check if the /hbase-unsecure directory exists
ls /

#Delete the /hbase-unsecure directory
rmr /hbase-unsecure #Older version
deleteall /hbase-unsecure #newer version

Finally, restart HBase

Attached:

If the command in the error message is executed:

hbase hbck -fixVersionFile

Then a new error will be reported, saying apps/hbase/data/.tmp/hbase-hbck.lock is occupied and you need to delete the lock file first

Delete command:

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

Similar Posts: