hbase_使用中遇到的问题(SessionExpiredException)

时间:2022-02-28 22:26:12

SessionExpiredException

不可恢复的异常

在某些情况下,ZooKeeper会话会失效——也许因为超时或因为会话被关闭,两种情况下都会收到KeeperException.SessionExpiredException异常,或因为身份验证失败,KeeperException.AuthFailedException异常。无论上述哪种情况,所有与会话相关联的短暂znode都将丢失,因此应用程序需要在重新连接到ZooKeeper之前重建它的状态。

2017-07-19 09:45:58,464 ERROR [main-EventThread] zookeeper.RecoverableZooKeeper: ZooKeeper exists failed after 4 attempts

2017-07-19 09:45:58,464 WARN  [main-EventThread] zookeeper.ZKUtil: master:60020-0x15d58751d000004, quorum=hykj-slave-4:2181,hykj-master-3:2181,hykj-slave-5:2181, baseZNode=/hbase Unable to set watcher on znode /hbase/master

org.apache.zookeeper.KeeperException$SessionExpiredException: KeeperErrorCode = Session expired for /hbase/master

at org.apache.zookeeper.KeeperException.create(KeeperException.java:127)

at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)

at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1045)

at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.exists(RecoverableZooKeeper.java:221)

at org.apache.hadoop.hbase.zookeeper.ZKUtil.watchAndCheckExists(ZKUtil.java:428)

at org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker.nodeDeleted(ZooKeeperNodeTracker.java:208)

at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.process(ZooKeeperWatcher.java:451)

at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:522)

at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498)

2017-07-19 09:45:58,464 ERROR [main-EventThread] zookeeper.ZooKeeperWatcher: master:60020-0x15d58751d000004, quorum=hykj-slave-4:2181,hykj-master-3:2181,hykj-slave-5:2181, baseZNode=/hbase Received unexpected KeeperException, re-throwing exception

org.apache.zookeeper.KeeperException$SessionExpiredException: KeeperErrorCode = Session expired for /hbase/master

at org.apache.zookeeper.KeeperException.create(KeeperException.java:127)

at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)

at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1045)

at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.exists(RecoverableZooKeeper.java:221)

at org.apache.hadoop.hbase.zookeeper.ZKUtil.watchAndCheckExists(ZKUtil.java:428)

at org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker.nodeDeleted(ZooKeeperNodeTracker.java:208)

at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.process(ZooKeeperWatcher.java:451)

at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:522)

at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498)

2017-07-19 09:45:58,464 FATAL [main-EventThread] master.HMaster: Master server abort: loaded coprocessors are: []

 

即,可能因为超时导致hbasezooksession中断,默认3分钟,可修改hbase-site.xml配置:

<property>

     <name>zookeeper.session.timeout</name>

     <value>240000</value>

    <!--默认: 180000 :zookeeper 会话超时时间,单位是毫秒 -->

</property>

注:这个时间还依赖于zookeeper自身的超时时间,如果太短也需要设置一下,在zookeeper的配置文件中配置:

minSessionTimeoutmaxSessionTimeout

详见zookeeper安装章节。