Wednesday, February 6, 2013

zookeeper logs snapshots PurgeTxnLog example

As warned in the documentation for Zookeeper, zookeeper keeps it's logs and snapshots forever. There is no automatic delete or clean feature and if you don't add some code after a Zookeeper install you will run out of disk space and your system will cease to operate as you are doing your development. Here is a 50G disk drive 100% utilized at the root volume level.

By default Zookeeper configures dataDir to be /var/lib/zookeeper in the default zoo.cfg configuration file at /etc/zookeeper/conf/zoo.cfg

Your snapshots and logs are under directory /var/lib/zookeeper/version-2. Here is what a directory looks like after zookeeper is being used:

Big mess of files which I have no use for. Today is 2/5 and I have files from November of last year.

To delete them cd into /usr/lib/zookeeper and run the following command: