A simple tool for browsing and modifying zookeeper trees.

Why does this tool exist?

Given that Zookeeper comes with ZKCli and many people have made nice web management systems like Netflix exhibitor you might wonder why you'd want a different browser. This tool's existence arises from 5 major frustrations with the existing options. Which really just boil down to a desire to edit JSON documents in-place and an issue with temporary Kafka consumers creating thousands of nodes that were never cleaned up. We also wanted to copy offsets between a collection of nodes and editing non-trivial data via the CLI was a pain. In particular though there were 5 pain points this tool targeted.

  1. Autogenerated node names can be a pain to navigate even with auto-complete.
    • JZookeeperEdit includes filtering via regex. Hiding all the auto-generated nodes makes seeing the small number of nodes you actually care about much easier. This also allows you to narrow your view to say all the nodes from a particular service making comparisons much easier. After all scrolling back and forth through 1000 nodes to compare some states is time consuming and prone to error.
  2. Editing data is a pain on a CLI and most of the web options don't support it.
    • JZookeeperEdit has a text box, maybe not the most fancy thing in the world but if you're trying to disable something at 2AM you'll be glad of a point and click.
    • Changing data in large nodes like JSON blobs can be challenging on the CLI.
  3. Deleting large numbers of nodes is both tricky and daunting.
    • If you want to keep your Zookeeper clean you may want to clear out old nodes or all nodes matching some pattern. Even command line gurus can find this hard with the tricky formatting of zkCli. JZookeeperEdit has a delete via regex option. If you find yourself wanting to clear out those 1000s of nodes an accidental random id generator created you'll spend a while on the normal zkCli and running it over thousands of nodes can take a surprisingly long time. In fact the first version of this tool was written while waiting for a bash script to do exactly that to complete. It took so long JZookeeperEdit ended up doing the job instead.
    • The delete via regex option has a preview so you can see exactly what you are about to delete. This has saved important nodes quite a few times.
  4. Alternatives may be hard to come by or hard to get installed.
    • Installing a web UI that the whole company can share is nice but getting that through your managers or systems team takes time. JZookeeperEdit is pre-packaged for most platforms and good to go so while your waiting for Exhibitor you can use JZookeeperEdit.
    • All the other options for local editors we found had been abandoned or were nigh on impossible to build.
  5. The built in zkCli is not nice for scripting.
    • The lack of a quiet mode makes it later hard with more unstructured node-content to actually extract the data you want. Short of writing a full blown parser that is. Plain old tools like sed and grep can do a lot but you spend so long fighting when you just wanted to ask your data a simple question. JZookeeperEdit's command line options are designed to compose well on the command line so you can easily combine calls to JZookeeperEdit with sed or grep then pass it right back in to JZookeeperEdit. Even with printwatches off it still puts cruft on stdout and the need to use printf to pass multiple commands to even be able to use printwatches is awkward.
    • JZookeeperEdit has a lot of sugar for common operations like:
      • Deleting all nodes under some other node.
      • Extracting a particular meta-field from a set of node.
      • Excluding certain children from a recursive delete.

Get a pre-built Binary

Pre-built binaries are available for most common platforms on Bintray

Using the CLI

Zookeeper comes with a nice little command line tool for exploration. However for scripting, the metadata and the format can be a pain. This tool comes with a limited (but more customisable in terms of output) cli of its own. The main aim here was to make a zkCli that was a little more unix-tools friendly.

You can see the current list of options by running the app with the -h flag e.g. If you are using the raw Jar then java -jar JZookeeperEdit.jar -h.

Several notable features include:

Support & Suggestions

Having trouble with JZookeeperEdit? The main readme might have the answer. If you think you've found an issue or would like to suggest a feature feel free to raise an issue. Suggestions are always appreciated. If you'd like a more freeform conversation or just to ask some questions or get some advice please join our gitter chatroom and ask away.