Skip to content

Instantly share code, notes, and snippets.

@emaxerrno
Created August 20, 2012 19:52
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save emaxerrno/3407216 to your computer and use it in GitHub Desktop.
Save emaxerrno/3407216 to your computer and use it in GitHub Desktop.
Zookeeper on ubuntu and monitoring
#!/bin/sh
echo "assumes java 7 is instlaled openjdk versio"
#pre dependencies
sudo apt-get install git-core pkg-config libtool automake make g++ connect-proxy unzip python
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
#install zeromq
git clone git clone git://github.com/zeromq/libzmq.git
pushd libzmq
./autogen.sh
./configure # add other options here
make
make check
sudo make install
sudo ldconfig
popd
#install the java bindings
git clone http://github.com/zeromq/jzmq
pushd jzmq
./autogen.sh
./configure
make
sudo make install
popd
#now install zookeeper
sudo apt-get install zookeeper #installs 3.3.5
export PATH=/usr/share/zookeeper/bin:$PATH
echo "Don't forget to modify /etc/zookeper/conf/myid"
echo "Don't forget to add /usr/share/zookeeper/bin to your PATH var permanently"
# needs this for zookpr as that is a failfast deamon :(
# supervisord is a deamon that watches your processes and restarts them if needed
sudo apt-get install supervisor python-pip python-dev
sudo pip install python-handler-socket
#add at the end of
sudo cat >> /etc/supervisor/supervisord.conf <<DELIMITER
[program:zookeeper]
command=/usr/share/zookeeper/bin/zkServer.sh start-foreground
process_name=%(program_name)s
autostart=true
autorestart=true
stopsignal=KILL
DELIMITER
tail -f /var/log/supervisor/supervisord.log &
sudo /etc/init.d/supervisor start
echo "If you got this far without errors, you owe alex a beer."
@jamescarr
Copy link

Why is jzmq needed? Just curious. :)

@dungvn3000
Copy link

Nice, this is extracly what i'm looking for, i owe you a beer :D

@ohthepain
Copy link

You spelled "zookeeper" incorrectly here:
echo "Don't forget to modify /etc/zookeper/conf/myid"

@bryan4887
Copy link

There is one too many "git clone"s on line 10.

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