Custom Search

Tuesday, March 17, 2015

How to Apache zookeeper configure session timeout

1)
Find location of zkServer.sh script
#find / -name zkServer.sh
OR
#locate zkServer.sh

2)
#cd cd /opt/stack/contrail/third_party/zookeeper-3.4.6/bin/

saju@ubuntu:/opt/stack/contrail/third_party/zookeeper-3.4.6/bin$ ls
README.txt  zkCleanup.sh  zkCli.cmd  zkCli.sh  zkEnv.cmd  zkEnv.sh  zkServer.cmd  zkServer.sh

3)
Find zoo.cfg

saju@ubuntu:/opt/stack/contrail/third_party/zookeeper-3.4.6/bin$ ./zkServer.sh --help
JMX enabled by default
Using config: /opt/stack/contrail/third_party/zookeeper-3.4.6/bin/../conf/zoo.cfg
Usage: ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}

4)
Edit "zoo.cfg" and change session timeout
saju@ubuntu:/opt/stack/contrail/third_party/zookeeper-3.4.6/bin$ sudo vim ../conf/zoo.cfg

# The number of milliseconds of each tick
tickTime=20000000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

5)
Stop zookeeper
#cd /opt/stack/contrail/third_party/zookeeper-3.4.6; ./bin/zkServer.sh stop & echo $! >/home/saju/contrail-installer/status/contrail/zk.pid; fg || echo "zk failed to start" | tee "/home/saju/contrail-installer/status/contrail/zk.failure

6)
Start zookeeper
#cd /opt/stack/contrail/third_party/zookeeper-3.4.6; ./bin/zkServer.sh start & echo $! >/home/saju/contrail-installer/status/contrail/zk.pid; fg || echo "zk failed to start" | tee "/home/saju/contrail-installer/status/contrail/zk.failure



1 comment:

  1. http://zookeeper.apache.org/doc/r3.2.2/zookeeperAdmin.html

    ReplyDelete