hbase伪分布式,与zookeeper同一台机器的时候,运行一段时间,启动zookeeper的时候,日志中有如下错误,导致无法启动zookeeper
java.io.IOException: Failed to process transaction type: 2 error: KeeperErrorCode = NoNode for /hbase/unassigned at org.apache.zookeeper.server.persistence.FileTxnSnapLog.restore(FileTxnSnapLog.java:152) at org.apache.zookeeper.server.ZKDatabase.loadDataBase(ZKDatabase.java:222) at org.apache.zookeeper.server.ZooKeeperServer.loadData(ZooKeeperServer.java:239) at org.apache.zookeeper.server.ZooKeeperServer.startdata(ZooKeeperServer.java:366) at org.apache.zookeeper.server.NIOServerCnxn$Factory.startup(NIOServerCnxn.java:160) at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:110) at org.apache.hadoop.hbase.zookeeper.HQuorumPeer.runZKServer(HQuorumPeer.java:79) at org.apache.hadoop.hbase.zookeeper.HQuorumPeer.main(HQuorumPeer.java:64)
由于是伪分布式,zookeeper集成在hbase的机器上,hbase的临时目录默认是放在/tmp的,而linux的/tmp目录是会被定期清理的(参考linux系统的tmpwatch)
所以解决办法是,修改hbase-site.xml,指定hbase.tmp.dir,这样hbase的tmp目录不会被定时清理,over~
<configuration> ....(省略) <property> <name>hbase.tmp.dir</name> <value>/hbase/tmp</value> <description>Temporary directory on the local filesystem.</description> </property> </configuration>