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.