I recreated an HBase service on one of my clusters and on start received a TableExistsException error:
Error:
org.apache.hadoop.hbase.master.TableNamespaceManager Namespace table not found. Creating... Jul 21, 1:23:40.026 PM FATAL org.apache.hadoop.hbase.master.HMaster Failed to become active master org.apache.hadoop.hbase.TableExistsException: hbase:namespace at org.apache.hadoop.hbase.master.handler.CreateTableHandler.checkAndSetEnablingTable(CreateTableHandler.java:152) at org.apache.hadoop.hbase.master.handler.CreateTableHandler.prepare(CreateTableHandler.java:125) at org.apache.hadoop.hbase.master.TableNamespaceManager.createNamespaceTable(TableNamespaceManager.java:233) ... Jul 21, 1:23:40.026 PM FATAL org.apache.hadoop.hbase.master.HMaster Master server abort: loaded coprocessors are: [] Jul 21, 1:23:40.026 PM FATAL org.apache.hadoop.hbase.master.HMaster Unhandled exception. Starting shutdown. org.apache.hadoop.hbase.TableExistsException: hbase:namespace at org.apache.hadoop.hbase.master.handler.CreateTableHandler.checkAndSetEnablingTable(CreateTableHandler.java:152) at org.apache.hadoop.hbase.master.handler.CreateTableHandler.prepare(CreateTableHandler.java:125) at org.apache.hadoop.hbase.master.TableNamespaceManager.createNamespaceTable(TableNamespaceManager.java:233) ... Jul 21, 1:23:40.027 PM INFO org.apache.hadoop.hbase.regionserver.HRegionServer STOPPED: Unhandled exception. Starting shutdown.
Resolution: ZooKeeper stores metadata from the previous setup. Clear this and restart.
Clear ZK znode:
zookeeper-client rmr /hbase
ONLY if needed, clear the HBase data from HDFS – ONLY DO THIS IF ABSOLUTELY NECESSARY AS ALL HBASE DATA WILL BE LOST:
sudo -u hdfs hadoop fs -rm -r /hbase/*