Skip to content

Instantly share code, notes, and snippets.

@solar
Created October 16, 2012 09:56
Show Gist options
  • Save solar/3898427 to your computer and use it in GitHub Desktop.
Save solar/3898427 to your computer and use it in GitHub Desktop.
install zookeeper with supervisord
#!/usr/local/bin/zsh
version="3.4.4"
priority="30404"
sudo mkdir -p /var/log/zookeeper /usr/local/zookeeper /var/zookeeper
curl -L http://ftp.kddilabs.jp/infosystems/apache/zookeeper/zookeeper-${version}/zookeeper-${version}.tar.gz | tar zx
sudo cp -r zookeeper-${version} /usr/local/zookeeper/${version}
sudo cp ./zookeeper.sh /usr/local/zookeeper/
sudo cp ./zoo.cfg /etc/
sudo cp ./supervisord.d/zookeeper.ini /etc/supervisord.d/
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/var/zookeeper
# the port at which the clients will connect
clientPort=2181
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
[program:zookeeper]
command=/usr/local/zookeeper/zookeeper.sh
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/var/log/zookeeper/stdout.log
#!/usr/local/bin/zsh
java=/usr/bin/java
conf=/etc/zoo.cfg
gclog=/var/log/zookeeper/gc.log
javaopts=(
-server
-Xmx1024m
-Xms1024m
-XX:NewSize=256m
-XX:MaxNewSize=256m
-XX:PermSize=256m
-XX:MaxPermSize=256m
-XX:+UseConcMarkSweepGC
-XX:+UseParNewGC
-Xloggc:$gclog
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-Duser.timezone=Asia/Tokyo
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.local.only=false
-Dzookeeper.root.logger="INFO,CONSOLE"
)
exec $java $javaopts \
-cp "/usr/local/zookeeper/3.4.4/bin/../build/classes:/usr/local/zookeeper/3.4.4/bin/../build/lib/*.jar:/usr/local/zookeeper/3.4.4/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper/3.4.4/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper/3.4.4/bin/../lib/netty-3.2.2.Final.jar:/usr/local/zookeeper/3.4.4/bin/../lib/log4j-1.2.15.jar:/usr/local/zookeeper/3.4.4/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper/3.4.4/bin/../zookeeper-3.4.4.jar:/usr/local/zookeeper/3.4.4/bin/../src/java/lib/*.jar:/usr/local/zookeeper/3.4.4/bin/../conf:" \
org.apache.zookeeper.server.quorum.QuorumPeerMain \
"$conf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment