ZooKeeper configuration

Starting / Stopping zookeeper and setting up a basic configuration is rather trivial, but there are a couple of gotcha’s that are worth documenting here.

I have setup a few OS environment variables:


In particular, the ZOOCFGDIR will direct ZooKeeper to look for a zoo.cfg file in that directory and use it for its configuration:

$ cat .zoo/zoo.cfg
# Zookeeper Configuration file
# Created MM 2013-10-08


Note the absence of spaces around the `=`: this is particularly important for the `dataDir` property: adding a leading space after the equal sign will cause ZK to create an “almost invisible” directory named ‘ ‘ (one space) in your current directory (whichever one may happen to be when you run the `zkServer.sh start` command) and use that as the root of the subtreee defined as the data directory.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: