This repository has been archived by the owner on Sep 22, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
405 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ZOO_LOG4J_PROP="INFO,ROLLINGFILE" | ||
ZOO_LOG_DIR="/var/log/zookeeper/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# | ||
# ZooKeeper Logging Configuration | ||
# | ||
|
||
# Format is "<default threshold> (, <appender>)+ | ||
|
||
# DEFAULT: console appender only | ||
#log4j.rootLogger=INFO, CONSOLE | ||
|
||
log4j.rootLogger=INFO, ROLLINGFILE | ||
|
||
# Example with rolling log file | ||
#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE | ||
|
||
# Example with rolling log file and tracing | ||
#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE | ||
|
||
# | ||
# Log INFO level and above messages to the console | ||
# | ||
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender | ||
log4j.appender.CONSOLE.Threshold=INFO | ||
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n | ||
|
||
# | ||
# Add ROLLINGFILE to rootLogger to get log file output | ||
# Log DEBUG level and above messages to a log file | ||
log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender | ||
log4j.appender.ROLLINGFILE.Threshold=DEBUG | ||
log4j.appender.ROLLINGFILE.File=/var/log/zookeeper/zookeeper.log | ||
|
||
# Max log file size of 10MB | ||
log4j.appender.ROLLINGFILE.MaxFileSize=10MB | ||
# uncomment the next line to limit number of backup files | ||
#log4j.appender.ROLLINGFILE.MaxBackupIndex=10 | ||
|
||
log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n | ||
|
||
|
||
# | ||
# Add TRACEFILE to rootLogger to get log file output | ||
# Log DEBUG level and above messages to a log file | ||
log4j.appender.TRACEFILE=org.apache.log4j.FileAppender | ||
log4j.appender.TRACEFILE.Threshold=TRACE | ||
log4j.appender.TRACEFILE.File=/var/log/zookeeper/zookeeper_trace.log | ||
|
||
log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout | ||
### Notice we are including log4j's NDC here (%x) | ||
log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L][%x] - %m%n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 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. | ||
dataDir=/var/lib/zookeeper/data | ||
# the port at which the clients will connect | ||
clientPort=2181 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
#!/bin/sh | ||
# | ||
# zookeeper ZooKeeper Server | ||
# | ||
# chkconfig: - 80 05 | ||
# description: Enable ZooKeeper Server | ||
# | ||
|
||
### BEGIN INIT INFO | ||
# Provides: zookeeper | ||
# Default-Start: | ||
# Default-Stop: | ||
# Required-Start: $remote_fs $network | ||
# Required-Stop: $remote_fs $network | ||
# Description: zookeeper Server | ||
# Short-Description: Enable zookeeper Server | ||
### END INIT INFO | ||
|
||
# Source function library. | ||
. /etc/rc.d/init.d/functions | ||
|
||
prog="zookeeper" | ||
desc="zookeeper Server" | ||
|
||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog | ||
|
||
lockfile="/var/lock/subsys/$prog" | ||
pidfile="/var/run/$prog.pid" | ||
|
||
[ "x$JMXLOCALONLY" = "x" ] && JMXLOCALONLY=false | ||
|
||
if [ "x$JMXDISABLE" = "x" ] | ||
then | ||
# for some reason these two options are necessary on jdk6 on Ubuntu | ||
# accord to the docs they are not necessary, but otw jconsole cannot | ||
# do a local attach | ||
ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY org.apache.zookeeper.server.quorum.QuorumPeerMain" | ||
else | ||
ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain" | ||
fi | ||
|
||
ZOOBINDIR="/usr/lib/zookeeper/bin" | ||
ZOOCFGDIR="/etc/zookeeper" | ||
ZOOCFG="zoo.cfg" | ||
ZOOCFG="$ZOOCFGDIR/$ZOOCFG" | ||
ZOO_LOG_DIR="/var/log/zookeeper" | ||
|
||
[ -e "$ZOOCFGDIR/java.env" ] && . "$ZOOCFGDIR/java.env" | ||
|
||
[ "x$ZOO_LOG4J_PROP" = "x" ] && ZOO_LOG4J_PROP="INFO,CONSOLE" | ||
|
||
for f in ${ZOOBINDIR}/../zookeeper-*.jar | ||
do | ||
CLASSPATH="$CLASSPATH:$f" | ||
done | ||
|
||
ZOOLIBDIR=${ZOOLIBDIR:-$ZOOBINDIR/../lib} | ||
for i in "$ZOOLIBDIR"/*.jar | ||
do | ||
CLASSPATH="$CLASSPATH:$i" | ||
done | ||
|
||
#add the zoocfg dir to classpath | ||
CLASSPATH=$ZOOCFGDIR:$CLASSPATH | ||
|
||
cmd="java \"-Dzookeeper.log.dir=${ZOO_LOG_DIR}\" \"-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}\" -cp ${CLASSPATH} ${JVMFLAGS} ${ZOOMAIN} ${ZOOCFG} & echo \$! > ${pidfile}" | ||
|
||
|
||
start() { | ||
echo -n $"Starting $desc ($prog): " | ||
touch $pidfile && chown zookeeper $pidfile | ||
daemon --user zookeeper --pidfile $pidfile "$cmd" | ||
retval=$? | ||
echo | ||
[ $retval -eq 0 ] && touch $lockfile | ||
return $retval | ||
} | ||
|
||
stop() { | ||
echo -n $"Stopping $prog: " | ||
killproc -p $pidfile $prog | ||
retval=$? | ||
echo | ||
[ $retval -eq 0 ] && rm -f $lockfile | ||
return $retval | ||
} | ||
|
||
restart() { | ||
stop | ||
start | ||
} | ||
|
||
reload() { | ||
restart | ||
} | ||
|
||
get_status() { | ||
status $prog | ||
RETVAL=$? | ||
STAT=`echo stat | nc localhost $(grep clientPort $ZOOCFG | sed -e 's/.*=//') 2> /dev/null| grep Mode` | ||
if [ "x$STAT" = "x" ] | ||
then | ||
echo "Error contacting service." | ||
else | ||
echo $STAT | ||
fi | ||
} | ||
|
||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
restart) | ||
restart | ||
;; | ||
reload) | ||
reload | ||
;; | ||
condrestart) | ||
[ -e /var/lock/subsys/$prog ] && restart | ||
RETVAL=$? | ||
;; | ||
status) | ||
get_status | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" | ||
RETVAL=1 | ||
esac | ||
|
||
exit $RETVAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/var/log/zookeeper/*.log { | ||
weekly | ||
rotate 10 | ||
copytruncate | ||
delaycompress | ||
compress | ||
notifempty | ||
missingok | ||
} |
Oops, something went wrong.