New ZooKeeper Browser app!

New ZooKeeper Browser app!

Hello animal lovers, in Hue 3, a new application was added in order to make Apache ZooKeeper easier to use: ZooKeeper Browser.

 

The app is not totally new: it consists of a rebasing from Hue 1 to Hue 3 of the ZooKeeper UI made by Andrei during his Google Summer of Code 3 years ago.

The main two features are:

  • Listing of the ZooKeeper cluster stats and clients
  • Browsing and editing of the ZNode hierarchy

 

ZooKeeper Browser requires the ZooKeeper REST service to be running on the same host as ZooKeeper itself. Here is how to set it up:

 

First get and build ZooKeeper:

git clone https://github.com/apache/zookeeper
cd zookeeper
ant
Buildfile: /home/hue/Development/zookeeper/build.xml

init:
    [mkdir] Created dir: /home/hue/Development/zookeeper/build/classes
    [mkdir] Created dir: /home/hue/Development/zookeeper/build/lib
    [mkdir] Created dir: /home/hue/Development/zookeeper/build/package/lib
    [mkdir] Created dir: /home/hue/Development/zookeeper/build/test/lib

…

Then start the REST service:

cd src/contrib/rest
nohup ant run&

 

If ZooKeeper and the REST service are not on the same machine as Hue, please update the Hue settings and specify the correct hostnames and ports:

 

[zookeeper]

  [[clusters]]

    [[[default]]]
      # Zookeeper ensemble. Comma separated list of Host/Port.
      # e.g. localhost:2181,localhost:2182,localhost:2183
      host_ports=localhost:2181

      # The URL of the REST contrib service
      rest_url=http://localhost:9998

 

And that’s it, jump up to ZooKeeper Browser!

 

As usual feel free to comment on the hue-user list or @gethue!

 

13 Comments

  1. chenfeic 4 years ago

    How to stop the REST service?

  2. marko 4 years ago

    Im using HUE 3.7.1 on ubuntu 14.04, apache hadoop 2.6.0, 1 namenode, 2 datanodes
    Im following these steps, the server is up and running:
    run:
    [echo] contrib: rest
    Starting grizzly …
    Started / – WADL: http://localhost:9998/application.wadl
    Server started.

    and when I want to open Zookeeper in HUE I get this message:
    Could not correctly connect to Zookeeper.
    [Errno 111] Connection refused

    The log gives me this:
    [12/Mar/2015 15:54:03 +0100] middleware INFO Processing exception: Could not correctly connect to Zookeeper.: Traceback (most recent call last):
    File “/usr/local/hue/build/env/lib/python2.7/site-packages/Django-1.4.5-py2.7.egg/django/core/handlers/base.py”, line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
    File “/usr/local/hue/apps/zookeeper/src/zookeeper/views.py”, line 72, in index
    raise PopupException(_(‘Could not correctly connect to Zookeeper.’), detail=e)
    PopupException: Could not correctly connect to Zookeeper.

    Any ideas why might have gone wrong? I remember during the build, there were some missing type messages but the build was suppose to be ok.:
    [javac] /home/ubuntu/zookeeper/src/java/main/org/apache/zookeeper/server/util/OSMXBean.java:89: warning : [rawtypes] found raw type: Class
    [javac] new Class[0]);
    [javac] ^
    [javac] missing type arguments for generic class Class
    [javac] where T is a type-variable:
    [javac] T extends Object declared in class Class
    [javac] 6 warnings

    jar:
    [jar] Building jar: /home/ubuntu/zookeeper/build/zookeeper-3.6.0-SNAPSHOT.jar

    BUILD SUCCESSFUL

  3. Hue Team 4 years ago

    Is the REST Server on the same machine? (cf. rest_url in the hue config)
    [Errno 111] Connection refused Hue points to nothing.

  4. marko 4 years ago

    Yes.
    heres my hue.ini: I tried with localhost and with hostname

    below – hue_server= name_node

    [zookeeper]

    [[clusters]]

    [[[default]]]
    # Zookeeper ensemble. Comma separated list of Host/Port.
    # e.g. localhost:2181,localhost:2182,localhost:2183
    ## host_ports=hue_server:2181
    host_ports=localhost:2181

    # The URL of the REST contrib service (required for znode browsing)
    ## rest_url=http://hue_server:9998
    rest_url=http://localhost:9998

  5. marko 4 years ago

    I combined these instructions with Apache Zookeeper instructions and now I ran ./$ZOOKEEPER_HOME/bin/zkServer.sh start
    Message was: Starting zookeeper … STARTED
    And I got rid of the initial problem.
    BUT! Now I came across the following issue which I also got when I installed Zookeeper following Apache instructions:
    When I click on Znode Hierarchy I get the following message:
    Server Error (500)
    Sorry, there’s been an error. An email was sent to your administrators. Thank you for your patience.

    Log give me this:

    12/Mar/2015 22:44:00 +0100] base ERROR Internal Server Error: /zookeeper/tree/default//
    Traceback (most recent call last):
    File “/usr/local/hue/build/env/lib/python2.7/site-packages/Django-1.4.5-py2.7.egg/django/core/handlers/base.py”, line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
    File “/usr/local/hue/apps/zookeeper/src/zookeeper/views.py”, line 116, in tree
    znode = zk.get(path)
    File “/usr/local/hue/apps/zookeeper/src/zookeeper/rest.py”, line 86, in get
    return self._do_get(url)
    File “/usr/local/hue/apps/zookeeper/src/zookeeper/rest.py”, line 175, in _do_get
    resp = simplejson.load(req)
    File “/usr/local/hue/build/env/lib/python2.7/site-packages/simplejson-2.0.9-py2.7-linux-x86_64.egg/simplejson/__init__.py”, line 267, in load
    parse_constant=parse_constant, **kw)
    File “/usr/local/hue/build/env/lib/python2.7/site-packages/simplejson-2.0.9-py2.7-linux-x86_64.egg/simplejson/__init__.py”, line 307, in loads
    return _default_decoder.decode(s)
    File “/usr/local/hue/build/env/lib/python2.7/site-packages/simplejson-2.0.9-py2.7-linux-x86_64.egg/simplejson/decoder.py”, line 335, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File “/usr/local/hue/build/env/lib/python2.7/site-packages/simplejson-2.0.9-py2.7-linux-x86_64.egg/simplejson/decoder.py”, line 353, in raw_decode
    raise ValueError(“No JSON object could be decoded”)
    ValueError: No JSON object could be decoded

    • Lubos 3 years ago

      It looks REST Zookeeper API doesn’t respond with JSON by default (in fact it returns empty string when called without headers). Use http header “Accept”, “application/json” and it will work (you have to edit script ‘/usr/local/hue/apps/zookeeper/src/zookeeper/rest.py’).

      def _do_get(self, uri):
      “”” Send a GET request and convert errors to exceptions “””
      try:
      req = urllib2.Request(uri)
      req.add_header(“Accept”, “application/json”);
      r = urllib2.urlopen(req)
      resp = json.load(r)

      if ‘Error’ in resp:
      raise ZooKeeper.Error(resp[‘Error’])

      return resp
      except urllib2.HTTPError, e:
      if e.code == 404:
      raise ZooKeeper.NotFound(uri)
      raise

  6. rainysia 2 years ago

    Hi, Does `rest_url` should be written like the host_ports part?

    I have 3 server, 1 namenode, 2 datanodes
    I run docker-hue on HDP2.4 namenode server, I’ve built REST server on namenode.
    Should i built and ran zookeeper Rest on each server? Thanks

    my hue.ini configuration:
    [zookeeper]
    [[clusters]]
    [[[default]]]
    host_ports=node1.test.org:2181,node2.test.org:2181,node3.test.org:2181
    rest_url=http://node1.test.org:9998,http://node2.test.org:9998,http://node2.test.org:9998

  7. lework 2 years ago

    How to set up in the cdh zookeeper the rest_url? Cdh version is 5.9.

Leave a reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.