Skip to content

Instantly share code, notes, and snippets.

@edwardw
Last active September 29, 2015 00:17
Show Gist options
  • Save edwardw/1517994 to your computer and use it in GitHub Desktop.
Save edwardw/1517994 to your computer and use it in GitHub Desktop.
Install zookeeper on illumos and supervise it using SMF

Two interesting findings:

  • A utility called manifold that helps creating SMF manifest;
  • An annoying platform compatibility issue in zookeeper startup script.

Fist, install zookeeper:

$ wget -c http://www.takeyellow.com/apachemirror//zookeeper/stable/zookeeper-3.3.4.tar.gz
$ tar xvzf zookeeper-3.3.4.tar.gz
$ ln -s zookeeper-3.3.4 zookeeper
$ cd zookeeper
$ cp conf/zoo_sample.cfg conf/zoo.cfg
$ mkdir var
$ vim conf/zoo.cfg

My zookeeper configuration file is very simple:

tickTime=2000
initLimit=10
syncLimit=5
dataDir=/home/edward/ws/sandbox/zookeeper/var
clientPort=2181

There seems to be a small platform compatibility issue in bin/zkServer.sh. Its line 103 reads:

if /bin/echo -n $! > "$ZOOPIDFILE"

On my illumos 151_a, the default echo ia actually /usr/gnu/bin/echo, not /bin/echo. And /bin/echo doesn't know option -n. Pid file ends up like -n 12345, not just 12345, which makes bin/zkServer.sh stop not able to stop zookeeper process properly.

Since I set up this illumos machine for hacking on its kernel (hopefully), it already has python installed (mercurial needs it). So next step only involves installing easy_install, then manifold:

$ sudo pkg install pkg:/library/python-2/setuptools-26
(according to http://docs.python-guide.org/en/latest/starting/installation/, one should use pip, not easy_install)
$ sudo easy_install pip
$ sudo pip install Manifold
$ manifold zookeeper.xml
$ svccfg validate zookeeper.xml
$ sudo svccfg import zookeeper.xml
$ svcs zookeeper
STATE          STIME    FMRI
disabled        2:12:14 svc:/site/zookeeper:default
$ sudo svcadm enable zookeeper
$ svcs zookeeper
STATE          STIME    FMRI
online          2:13:40 svc:/site/zookeeper:default
@mtzaurus
Copy link

s/sudo pip Manifold/sudo pip install Manifold/

@edwardw
Copy link
Author

edwardw commented Oct 24, 2013

Indeed! Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment