Pivotal Knowledge Base

Follow

Pivotal HD: About how to correctly config zookeeper session timeout parameter minSessionTimeout and maxSessionTimeout

Environment:

   HBase in PHD

Purpose:

  Zookeeper client from region server node keeps reporting session time out with zookeeper server. We need to  expand session time to meet what environment needs.

Reference:

http://wiki.apache.org/hadoop/Hbase/Troubleshooting#A8

Required parameters:

hbase-site.xml

<property>
   <name>zookeeper.session.timeout</name>
   <value>1200000</value>
</property>
<property>
   <name>hbase.zookeeper.property.tickTime</name>
   <value>6000</value>
</property>

zoo.cfg
# The basic time unit in milliseconds used by ZooKeeper. It is used to do heartbeats and the minimum session timeout will be twice the tickTime.
tickTime=2000


Result:

from the code piece of zookeeper server source code, we could see the logic


public int getMinSessionTimeout() {
return minSessionTimeout == -1 ? tickTime * 2 : minSessionTimeout;
}  
public int getMaxSessionTimeout() {
return maxSessionTimeout == -1 ? tickTime * 20 : maxSessionTimeout;
}


int minSessionTimeout = zk.getMinSessionTimeout();
if (sessionTimeout < minSessionTimeout) {
sessionTimeout = minSessionTimeout;
}
int maxSessionTimeout = zk.getMaxSessionTimeout();
if (sessionTimeout > maxSessionTimeout) {
sessionTimeout = maxSessionTimeout;
}

 

these two values for getMinSessionTimeout and maxSessionTimeout are 2 times and 20 times ticktime respectively. The default value for ticktime is 3 seconds, so final value for zookeeper server timeout is between 6s and 60s.

Since there are two configuration files, one in zookeeper client side "hbase-site.xml", the other in zookeeper server side "zoo.cfg". We should config both of them. 
After client has send the value to server, server will also adjust the session time out value using these two parameters above, minSessionTimeout and maxSessionTimeout.

 

Comments

Powered by Zendesk