Fork me on GitHub

zookeeper的maxSessionTimeout默认值导致hbase regionserver超时

zookeeper的maxSessionTimeout默认值导致hbase regionserver超时


在hbase中经常会遇到regionserver挂掉的情况,查看日志会看到这样的错误信息
2016-02-16 11:51:24,882 WARN  [master/hadoop02/192.168.100.5:6000] zookeeper.ZKUtil: master:6000-0x3525df55101a556, quorum=hadoop02:2181,hadoop03:2181,hadoop01:2181, baseZNode=/hbase Unable to get data of znode /hbase/xx
org.apache.zookeeper.KeeperException$SessionExpiredException: KeeperErrorCode = Session expired for /hbase/xx
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:127)
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
        at org.apache.zookeeper.ZooKeeper.getData(ZooKeeper.java:1155)
        at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.getData(RecoverableZooKeeper.java:359)
        at org.apache.hadoop.hbase.zookeeper.ZKUtil.getData(ZKUtil.java:745)



说明与zookeeper的连接的session超时了,可是在hbase-site.xml中设置了zookeeper的超时时间为2分钟,原来
zookeeper中自带两个参数设置了session的超时时间,在启动时日志中会显示
2016-02-16 11:39:49,164 - INFO  [main:QuorumPeer@992] - tickTime set to 2000
2016-02-16 11:39:49,165 - INFO  [main:QuorumPeer@1012] - minSessionTimeout set to -1
2016-02-16 11:39:49,165 - INFO  [main:QuorumPeer@1023] - maxSessionTimeout set to -1


而minSessionTimeout 和maxSessionTimeout 是用下面的方式算出来的
public int getMinSessionTimeout()
{ return minSessionTimeout == -1 ? tickTime * 2 : minSessionTimeout; } 
public int getMaxSessionTimeout() 
{ return maxSessionTimeout == -1 ? tickTime * 20 : maxSessionTimeout; }


默认情况,tickTime=2sec,那么minSessionTimeout 和 maxSessionTimeout 分别是4sec和40sec


所以在hbase中设置超时时间是没用的,必须修改zookeeper自身的maxSessionTimeout为1200000,才能真正起到加长zookeeper的session超时时间的作用
posted @ 2016-02-17 11:42  程序优化  阅读(2152)  评论(0编辑  收藏  举报