Apache Zookeeper may not be the most interesting and appealing service but it plays a major role in many distributed systems like Hadoop or Kafka that use it to synchronize between different nodes and to store their state.
Zookeeper resembles a filesystem. It has znodes where each znodes can contain leaf znodes (analogous to files) or child znodes (analogous to sub directories).
ZooKeeper is usually a low maintenance service that just work without needing much attention. But sometimes you need to take a closer look at what’s going inside. For example, in our Hadoop cluster we had situations where both Resource managers were in standby mode and we suspected that the root problem is in zookeeper, so we had to check what’s going on inside.
Of course, ZooKeeper comes with a command line client but it’s not very convenient and if there are many child znodes then its output is hard to read. So it’s better to use a Graphic tool to look inside ZooKeeper. There are several of them out there and we will test Three of them in this post.
Zuki is a nice and simple tool written in Python. You can download prebuilt binaries for Windows here, or you can follow the instructions and build it by yourself. After download, just unzip the file and run zuki.exe and you will see the login screen:
After successful login you can browse the znode tree in the left pane. When you click on a leaf node you can see its contents in the right pane. You can also change the znode’s content, but you would not normally want to do that unless you are developing or debugging a service that uses zookeeper, or you know very well what you are doing.
ZooInspector does basically the same things Zuki can do, but it uses the outdated Java Swing library which gives it a 2005 look and feel. It does the job, but it is hard to go back to old Swing after many years of sleek web UI’s.
First build and install it, then run it:
yum install git maven git clone https://github.com/zzhang5/zooinspector.git cd zooinspector mvn clean package chmod +x target/zooinspector-pkg/bin/zooinspector.sh target/zooinspector-pkg/bin/zooinspector.sh
Then enter the connect string which is one of your zookeper servers and the zookeeper port:
And this is how it looks like when you browse the znodes. Pretty much like Zuki, but with older UI:
JetBrains has a zookeeper plugin that works with pycharm as well as Intelij Idea. This plugin enables all the basic zookeeper operations like znode browsing, viewing and changing leaf znodes, etc.
I usually write python so I used PyCharm for testing, but the procedure is similar in Intelij Idea.
First download the plugin itself, then go to setting –> plugins, then click “install plugin from disk”:
Browse for the plugin file you downloaded and choose it. Now highlight the zookeeper plugin and click “restart pycharm”:
After restart, go to settings again and you will see that a new zookeeper item was added. Click it and enter your zookeeper hosts in the quorum field. You should also enter the port (if not standard) and a path. Don’t forget to check the “Enable zookeeper” check box:
After clicking “ok” or “apply” you will see that a new tab named “zookeeper” was added to the left. Clicking on it opens a znode tree on the left pane that you can browse. Clicking on a leaf znode shows its content on the right pane. If you edit the content in the right pane you can save it like an other file and it will be saved in zookeeper:
I liked Zuki most, because its simple and effective design and ease of use. ZooInspector does the job but its Swing UI makes it look and feel old, so it’s my second choice. If you are developing a program that uses oozie on a Jetbrains IDE then their plugin is a good choice. It can help you debug your program and see what it’s doing in Zookeeper straight from your IDE, but otherwise it is less convenient and you shouldn’t install a whole IDE just to look inside Zookeeper (I guess the Eclipse plugin is similar). So working with a standalone app or an IDE plugin depends on the kind of work you need to do.