用 hadoop namenode -fromat 格式化后,用./start-hbase.sh 启动HMaster和HRegionServer,但是过几秒种后HMaster进程自动关闭,HRegionServer进程没有关闭,查看日志报如下错:
2017-10-24 01:05:08,923 DEBUG [main-SendThread(remote:2181)] zookeeper.ClientCnxn: Reading reply sessionid:0x15f4c767f3a0008, packet:: clientPath:null serverPath:null finished:false header:: 111,2 replyHeader:: 111,727,0 request:: '/hbase/table-lock/hbase:namespace/write-master:160200000000004,0 response:: null 2017-10-24 01:05:08,924 DEBUG [remote:16020.activeMasterManager] lock.ZKInterProcessLockBase: Released /hbase/table-lock/hbase:namespace/write-master:160200000000004 2017-10-24 01:05:08,924 FATAL [remote:16020.activeMasterManager] 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:151) at org.apache.hadoop.hbase.master.handler.CreateTableHandler.prepare(CreateTableHandler.java:124) at org.apache.hadoop.hbase.master.TableNamespaceManager.createNamespaceTable(TableNamespaceManager.java:233) at org.apache.hadoop.hbase.master.TableNamespaceManager.start(TableNamespaceManager.java:86) at org.apache.hadoop.hbase.master.HMaster.initNamespace(HMaster.java:868) at org.apache.hadoop.hbase.master.HMaster.finishActiveMasterInitialization(HMaster.java:719) at org.apache.hadoop.hbase.master.HMaster.access$500(HMaster.java:165) at org.apache.hadoop.hbase.master.HMaster$1.run(HMaster.java:1425) at java.lang.Thread.run(Thread.java:745) 2017-10-24 01:05:08,926 FATAL [remote:16020.activeMasterManager] master.HMaster: Master server abort: loaded coprocessors are: [] 2017-10-24 01:05:08,926 FATAL [remote:16020.activeMasterManager] master.HMaster: Unhandled exception. Starting shutdown. org.apache.hadoop.hbase.TableExistsException: hbase:namespace at org.apache.hadoop.hbase.master.handler.CreateTableHandler.checkAndSetEnablingTable(CreateTableHandler.java:151) at org.apache.hadoop.hbase.master.handler.CreateTableHandler.prepare(CreateTableHandler.java:124) at org.apache.hadoop.hbase.master.TableNamespaceManager.createNamespaceTable(TableNamespaceManager.java:233) at org.apache.hadoop.hbase.master.TableNamespaceManager.start(TableNamespaceManager.java:86) at org.apache.hadoop.hbase.master.HMaster.initNamespace(HMaster.java:868) at org.apache.hadoop.hbase.master.HMaster.finishActiveMasterInitialization(HMaster.java:719) at org.apache.hadoop.hbase.master.HMaster.access$500(HMaster.java:165) at org.apache.hadoop.hbase.master.HMaster$1.run(HMaster.java:1425) at java.lang.Thread.run(Thread.java:745)
是因为zookeeper中某些文件遗留的原因导致的呢?所以我将dataDir=/opt/zookeeper-3.4.5/data 目录下的version-2给删除,并且重启了服务器。然后重启开启后,HMaster进程正常运行。再打开 dataDir=/opt/zookeeper-3.4.5/data目录发现产生了新的version-2 .