Saturday, 2 January 2016

UI for Zookeeper - zk-web

I have been using Zookeeper for the configuration management of my application. There are usually various configurations stored in zookeeper and sometimes it happens that we have to check the configuration values. Using zk-cli command line utility we can accomplish this however zk-cli is a command line tool and you need to learn commands in order get the information out of it.

So I was looking for a GUI Tool which would be simple and cleaner and luckily I found one known as zk-web (https://github.com/qiuxiafei/zk-web).

All the installation instruction can be found here (https://github.com/qiuxiafei/zk-web), However while installing it I faced some issues and thought it would be worth sharing all the steps to have a hassle free installation.

Prerequisites:
  • Java ( > Java 6 update 40 )
  • Git
  • Lien

Installing git:

sudo yum install git (My machine was amazon ec2 Linux)
sudo apt-get install git (If the machine is having ubuntu Linux)

NOTE: Make sure you are running on java version higher than java 6 update 40 If not upgrade the java version.

Cloning git repository for zk-web:

git clone git://github.com/qiuxiafei/zk-web.git

Configuration File:

cd zk-web/conf/

[ec2-user@ip-xx-xxx-x-xxx conf]$ cat zk-web-conf.clj
{
:server-port 8080
:users {"admin" "hello"}
:default-node ""
}

Installing lein:

wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
wget --no-check-certificate https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein

Move lein to ~/bin so that it will be available on PATH.

Grant execute permissions to lein:
cd ~/bin/
chmod 755 lein

To start zk-web run the below commands:
lein deps
lein run

Now the zk-web should be available at Your_IP:8080 URL.

Most of the time we want zk-web to run as a background process so that we can use it without the need to start it. In this scenario there is an option to generate a jar file using lein:

[ec2-user@ip-xx-xxx-x-xxx zk-web]$ cat project.clj
(defproject zk-web "0.1.0-SNAPSHOT"
     :description "FIXME: write this!"
     :dependencies [[org.clojure/clojure "1.4.0"]
       [noir "1.3.0-beta3"]
       [com.netflix.curator/curator-framework "1.1.16"]
       [com.netflix.curator/curator-test "1.1.16"]]
     :main zk-web.server)

Now using lein we have to build this clj(closure) file.
lein uberjar

This will build 2 jar files:
zk-web-0.1.0-SNAPSHOT.jar
zk-web-0.1.0-SNAPSHOT-standalone.jar

We have to use the second one which is a standalone jar. Below is command we can use to run this jar in background:
nohup java -jar target/zk-web-0.1.0-SNAPSHOT-standalone.jar &

As an alternative, we can put this command to /etc/rc.local file to start zk-web on machine reboot.

No comments:

Post a Comment