有时候,HBase因为在写入过程中直接强行中断之后,再次重启过程中,会经常出现一些异常信息。其中标题这个错误也是经常碰到的一个。
具体报的错误如下:

2016-09-28 14:08:16,448 ERROR [main]client.ConnectionManager$HConnectionImplementation: The node /hbase is not inZooKeeper. It should have been written by the master. Check the valueconfigured in 'zookeeper.znode.parent'. There could be a mismatch with the oneconfigured in the master.
从这个错误来看,明显是因为有个zookeeper配置没有找到,导致联接不上了。
按照网上的各种说法,如想到直接的办法是把zookeeper中的数据删除再重启HBase,或者修改一下HBase的配置文件,但是发现也不行。
再仔细考虑一下,由于之前在写入过程中强行中断,导致可能有些数据块存在错误导致的。
经过仔细查找,这种数据块错误有个专门的处理方式
具体做法如下:
(1) 修复HBASE的元数据
到HBASE的根目录下,运行如下命令
./bin/hbase org.apache.hadoop.hbase.util.hbck.OfflineMetaRepair
(2) 删除zookeeper中的数据
进入zookeeper根目录下,运行zkcli程序,运行rm -r /hbase。
(3) 重启zookeeper与HBase,果然成功搞定。