summaryrefslogtreecommitdiff
path: root/MPE/zookeeper
diff options
context:
space:
mode:
Diffstat (limited to 'MPE/zookeeper')
-rw-r--r--MPE/zookeeper/bin/README.txt6
-rw-r--r--MPE/zookeeper/bin/change_myid.sh14
-rw-r--r--MPE/zookeeper/bin/create_cmak_node.sh7
-rw-r--r--MPE/zookeeper/bin/dae-zookeeper.sh39
-rw-r--r--MPE/zookeeper/bin/old/zkEnv.sh115
-rw-r--r--MPE/zookeeper/bin/old/zkServer.sh225
-rw-r--r--MPE/zookeeper/bin/set_zk_env.sh16
-rw-r--r--MPE/zookeeper/bin/zkCleanup.sh51
-rw-r--r--MPE/zookeeper/bin/zkCli.cmd24
-rw-r--r--MPE/zookeeper/bin/zkCli.sh41
-rw-r--r--MPE/zookeeper/bin/zkEnv.cmd49
-rw-r--r--MPE/zookeeper/bin/zkEnv.sh116
-rw-r--r--MPE/zookeeper/bin/zkServer.cmd24
-rw-r--r--MPE/zookeeper/bin/zkServer.sh225
-rw-r--r--MPE/zookeeper/bin/zklogdelete.sh18
-rw-r--r--MPE/zookeeper/conf/configuration.xsl24
-rw-r--r--MPE/zookeeper/conf/java.env6
-rw-r--r--MPE/zookeeper/conf/log4j.properties63
-rw-r--r--MPE/zookeeper/conf/zoo.cfg51
-rw-r--r--MPE/zookeeper/conf/zoo_sample.cfg28
20 files changed, 1142 insertions, 0 deletions
diff --git a/MPE/zookeeper/bin/README.txt b/MPE/zookeeper/bin/README.txt
new file mode 100644
index 0000000..e70506d
--- /dev/null
+++ b/MPE/zookeeper/bin/README.txt
@@ -0,0 +1,6 @@
+This directory contain scripts that allow easy access (classpath in particular)
+to the ZooKeeper server and command line client.
+
+Files ending in .sh are unix and cygwin compatible
+
+Files ending in .cmd are msdos/windows compatible
diff --git a/MPE/zookeeper/bin/change_myid.sh b/MPE/zookeeper/bin/change_myid.sh
new file mode 100644
index 0000000..a43f0db
--- /dev/null
+++ b/MPE/zookeeper/bin/change_myid.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+id=1
+
+for i in `echo "[u'192.168.20.221', u'192.168.20.222', u'192.168.20.223']" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"`
+do
+ip=`echo $i | grep -E -o "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"`
+echo 'server.'$id'='$ip':2888:3888' >> /data/tsg/olap/zookeeper-3.4.10/conf/zoo.cfg
+if [[ $ip == 192.168.20.223 ]];then
+ echo $id > /data/tsg/olap/zookeeper-3.4.10/data/myid
+fi
+((id++))
+done
+
diff --git a/MPE/zookeeper/bin/create_cmak_node.sh b/MPE/zookeeper/bin/create_cmak_node.sh
new file mode 100644
index 0000000..e5d3e97
--- /dev/null
+++ b/MPE/zookeeper/bin/create_cmak_node.sh
@@ -0,0 +1,7 @@
+/data/tsg/olap/zookeeper-3.4.10/bin/zkCli.sh create /kafka-manager ""
+sleep 3
+/data/tsg/olap/zookeeper-3.4.10/bin/zkCli.sh create /kafka-manager/mutex ""
+sleep 3
+/data/tsg/olap/zookeeper-3.4.10/bin/zkCli.sh create /kafka-manager/mutex/locks ""
+sleep 3
+/data/tsg/olap/zookeeper-3.4.10/bin/zkCli.sh create /kafka-manager/mutex/leases ""
diff --git a/MPE/zookeeper/bin/dae-zookeeper.sh b/MPE/zookeeper/bin/dae-zookeeper.sh
new file mode 100644
index 0000000..4598236
--- /dev/null
+++ b/MPE/zookeeper/bin/dae-zookeeper.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+source /etc/profile
+
+#安装路径
+BASE_DIR=/data/tsg/olap
+VERSION=zookeeper-3.4.10
+
+function setlog(){
+RES_SUM_FILE=$BASE_DIR/$VERSION/logs
+
+if [ ! -f "$RES_SUM_FILE/" ]
+then
+ mkdir -p $RES_SUM_FILE
+fi
+
+if [ ! -d "$RES_SUM_FILE/$1" ];then
+ echo "0" > $RES_SUM_FILE/zkRes_sum
+fi
+
+OLD_NUM=`cat $RES_SUM_FILE/zkRes_sum`
+RESTART_NUM=`expr $OLD_NUM + 1`
+echo $RESTART_NUM > $RES_SUM_FILE/zkRes_sum
+
+if [ $OLD_NUM -eq "0" ];then
+ echo "`date "+%Y-%m-%d %H:%M:%S"` - Zookeeper服务初次启动" >> $BASE_DIR/$VERSION/logs/restart.log
+else
+ echo "`date +%Y-%m-%d` `date +%H:%M:%S` - Zookeeper服务异常 - 重启次数 -> $RESTART_NUM." >> $BASE_DIR/$VERSION/logs/restart.log
+fi
+}
+
+while true ; do
+HAS_ZK=`$BASE_DIR/$VERSION/bin/zkServer.sh status | egrep 'leader|follower' | wc -l`
+if [ $HAS_ZK -lt "1" ];then
+ $BASE_DIR/$VERSION/bin/zkServer.sh start
+ setlog
+fi
+sleep 60
+done
+
diff --git a/MPE/zookeeper/bin/old/zkEnv.sh b/MPE/zookeeper/bin/old/zkEnv.sh
new file mode 100644
index 0000000..687c45a
--- /dev/null
+++ b/MPE/zookeeper/bin/old/zkEnv.sh
@@ -0,0 +1,115 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This script should be sourced into other zookeeper
+# scripts to setup the env variables
+
+# We use ZOOCFGDIR if defined,
+# otherwise we use /etc/zookeeper
+# or the conf directory that is
+# a sibling of this script's directory
+
+ZOOBINDIR="${ZOOBINDIR:-/usr/bin}"
+ZOOKEEPER_PREFIX="${ZOOBINDIR}/.."
+
+if [ "x$ZOOCFGDIR" = "x" ]
+then
+ if [ -e "${ZOOKEEPER_PREFIX}/conf" ]; then
+ ZOOCFGDIR="$ZOOBINDIR/../conf"
+ else
+ ZOOCFGDIR="$ZOOBINDIR/../etc/zookeeper"
+ fi
+fi
+
+if [ -f "${ZOOCFGDIR}/zookeeper-env.sh" ]; then
+ . "${ZOOCFGDIR}/zookeeper-env.sh"
+fi
+
+if [ "x$ZOOCFG" = "x" ]
+then
+ ZOOCFG="zoo.cfg"
+fi
+
+ZOOCFG="$ZOOCFGDIR/$ZOOCFG"
+
+if [ -f "$ZOOCFGDIR/java.env" ]
+then
+ . "$ZOOCFGDIR/java.env"
+fi
+
+if [ "x${ZOO_LOG_DIR}" = "x" ]
+then
+ ZOO_LOG_DIR="${ZOOKEEPER_PREFIX}/logs/system"
+fi
+
+if [ "x${ZOO_LOG4J_PROP}" = "x" ]
+then
+ ZOO_LOG4J_PROP="ERROR,CONSOLE"
+fi
+
+if [ "$JAVA_HOME" != "" ]; then
+ JAVA="$JAVA_HOME/bin/java"
+else
+ JAVA=java
+fi
+
+#add the zoocfg dir to classpath
+CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
+
+for i in "$ZOOBINDIR"/../src/java/lib/*.jar
+do
+ CLASSPATH="$i:$CLASSPATH"
+done
+
+#make it work in the binary package
+#(use array for LIBPATH to account for spaces within wildcard expansion)
+if [ -e "${ZOOKEEPER_PREFIX}"/share/zookeeper/zookeeper-*.jar ]; then
+ LIBPATH=("${ZOOKEEPER_PREFIX}"/share/zookeeper/*.jar)
+else
+ #release tarball format
+ for i in "$ZOOBINDIR"/../zookeeper-*.jar
+ do
+ CLASSPATH="$i:$CLASSPATH"
+ done
+ LIBPATH=("${ZOOBINDIR}"/../lib/*.jar)
+fi
+
+for i in "${LIBPATH[@]}"
+do
+ CLASSPATH="$i:$CLASSPATH"
+done
+
+#make it work for developers
+for d in "$ZOOBINDIR"/../build/lib/*.jar
+do
+ CLASSPATH="$d:$CLASSPATH"
+done
+
+#make it work for developers
+CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH"
+
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ *) cygwin=false ;;
+esac
+
+if $cygwin
+then
+ CLASSPATH=`cygpath -wp "$CLASSPATH"`
+fi
+
+#echo "CLASSPATH=$CLASSPATH"
diff --git a/MPE/zookeeper/bin/old/zkServer.sh b/MPE/zookeeper/bin/old/zkServer.sh
new file mode 100644
index 0000000..396aedd
--- /dev/null
+++ b/MPE/zookeeper/bin/old/zkServer.sh
@@ -0,0 +1,225 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# If this scripted is run out of /usr/bin or some other system bin directory
+# it should be linked to and not copied. Things like java jar files are found
+# relative to the canonical path of this script.
+#
+
+
+
+# use POSTIX interface, symlink is followed automatically
+ZOOBIN="${BASH_SOURCE-$0}"
+ZOOBIN="$(dirname "${ZOOBIN}")"
+ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"
+
+if [ -e "$ZOOBIN/../libexec/zkEnv.sh" ]; then
+ . "$ZOOBINDIR/../libexec/zkEnv.sh"
+else
+ . "$ZOOBINDIR/zkEnv.sh"
+fi
+
+# See the following page for extensive details on setting
+# up the JVM to accept JMX remote management:
+# http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html
+# by default we allow local JMX connections
+if [ "x$JMXLOCALONLY" = "x" ]
+then
+ JMXLOCALONLY=false
+fi
+
+if [ "x$JMXDISABLE" = "x" ] || [ "$JMXDISABLE" = 'false' ]
+then
+ echo "ZooKeeper JMX enabled by default" >&2
+ if [ "x$JMXPORT" = "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
+ if [ "x$JMXAUTH" = "x" ]
+ then
+ JMXAUTH=false
+ fi
+ if [ "x$JMXSSL" = "x" ]
+ then
+ JMXSSL=false
+ fi
+ if [ "x$JMXLOG4J" = "x" ]
+ then
+ JMXLOG4J=true
+ fi
+ echo "ZooKeeper remote JMX Port set to $JMXPORT" >&2
+ echo "ZooKeeper remote JMX authenticate set to $JMXAUTH" >&2
+ echo "ZooKeeper remote JMX ssl set to $JMXSSL" >&2
+ echo "ZooKeeper remote JMX log4j set to $JMXLOG4J" >&2
+ ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMXPORT -Dcom.sun.management.jmxremote.authenticate=$JMXAUTH -Dcom.sun.management.jmxremote.ssl=$JMXSSL -Dzookeeper.jmx.log4j.disable=$JMXLOG4J org.apache.zookeeper.server.quorum.QuorumPeerMain"
+ fi
+else
+ echo "JMX disabled by user request" >&2
+ ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
+fi
+
+if [ "x$SERVER_JVMFLAGS" != "x" ]
+then
+ JVMFLAGS="$SERVER_JVMFLAGS $JVMFLAGS"
+fi
+
+if [ "x$2" != "x" ]
+then
+ ZOOCFG="$ZOOCFGDIR/$2"
+fi
+
+# if we give a more complicated path to the config, don't screw around in $ZOOCFGDIR
+if [ "x$(dirname "$ZOOCFG")" != "x$ZOOCFGDIR" ]
+then
+ ZOOCFG="$2"
+fi
+
+if $cygwin
+then
+ ZOOCFG=`cygpath -wp "$ZOOCFG"`
+ # cygwin has a "kill" in the shell itself, gets confused
+ KILL=/bin/kill
+else
+ KILL=kill
+fi
+
+echo "Using config: $ZOOCFG" >&2
+
+case "$OSTYPE" in
+*solaris*)
+ GREP=/usr/xpg4/bin/grep
+ ;;
+*)
+ GREP=grep
+ ;;
+esac
+if [ -z "$ZOOPIDFILE" ]; then
+ ZOO_DATADIR="$($GREP "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//')"
+ if [ ! -d "$ZOO_DATADIR" ]; then
+ mkdir -p "$ZOO_DATADIR"
+ fi
+ ZOOPIDFILE="$ZOO_DATADIR/zookeeper_server.pid"
+else
+ # ensure it exists, otw stop will fail
+ mkdir -p "$(dirname "$ZOOPIDFILE")"
+fi
+
+if [ ! -w "$ZOO_LOG_DIR" ] ; then
+mkdir -p "$ZOO_LOG_DIR"
+fi
+
+_ZOO_DAEMON_OUT="$ZOO_LOG_DIR/zookeeper.log"
+
+case $1 in
+start)
+ echo -n "Starting zookeeper ... "
+ if [ -f "$ZOOPIDFILE" ]; then
+ if kill -0 `cat "$ZOOPIDFILE"` > /dev/null 2>&1; then
+ echo $command already running as process `cat "$ZOOPIDFILE"`.
+ exit 0
+ fi
+ fi
+ nohup "$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" > "$_ZOO_DAEMON_OUT" 2>&1 < /dev/null &
+ if [ $? -eq 0 ]
+ then
+ case "$OSTYPE" in
+ *solaris*)
+ /bin/echo "${!}\\c" > "$ZOOPIDFILE"
+ ;;
+ *)
+ /bin/echo -n $! > "$ZOOPIDFILE"
+ ;;
+ esac
+ if [ $? -eq 0 ];
+ then
+ sleep 1
+ echo STARTED
+ else
+ echo FAILED TO WRITE PID
+ exit 1
+ fi
+ else
+ echo SERVER DID NOT START
+ exit 1
+ fi
+ ;;
+start-foreground)
+ ZOO_CMD=(exec "$JAVA")
+ if [ "${ZOO_NOEXEC}" != "" ]; then
+ ZOO_CMD=("$JAVA")
+ fi
+ "${ZOO_CMD[@]}" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG"
+ ;;
+print-cmd)
+ echo "\"$JAVA\" -Dzookeeper.log.dir=\"${ZOO_LOG_DIR}\" -Dzookeeper.root.logger=\"${ZOO_LOG4J_PROP}\" -cp \"$CLASSPATH\" $JVMFLAGS $ZOOMAIN \"$ZOOCFG\" > \"$_ZOO_DAEMON_OUT\" 2>&1 < /dev/null"
+ ;;
+stop)
+ echo -n "Stopping zookeeper ... "
+ if [ ! -f "$ZOOPIDFILE" ]
+ then
+ echo "no zookeeper to stop (could not find file $ZOOPIDFILE)"
+ else
+ $KILL -9 $(cat "$ZOOPIDFILE")
+ rm "$ZOOPIDFILE"
+ echo STOPPED
+ fi
+ exit 0
+ ;;
+upgrade)
+ shift
+ echo "upgrading the servers to 3.*"
+ "$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.server.upgrade.UpgradeMain ${@}
+ echo "Upgrading ... "
+ ;;
+restart)
+ shift
+ "$0" stop ${@}
+ sleep 3
+ "$0" start ${@}
+ ;;
+status)
+ # -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output
+ clientPortAddress=`$GREP "^[[:space:]]*clientPortAddress[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'`
+ if ! [ $clientPortAddress ]
+ then
+ clientPortAddress="localhost"
+ fi
+ clientPort=`$GREP "^[[:space:]]*clientPort[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'`
+ STAT=`"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain \
+ $clientPortAddress $clientPort srvr 2> /dev/null \
+ | $GREP Mode`
+ if [ "x$STAT" = "x" ]
+ then
+ echo "Error contacting service. It is probably not running."
+ exit 1
+ else
+ echo $STAT
+ exit 0
+ fi
+ ;;
+*)
+ echo "Usage: $0 {start|start-foreground|stop|restart|status|upgrade|print-cmd}" >&2
+
+esac
diff --git a/MPE/zookeeper/bin/set_zk_env.sh b/MPE/zookeeper/bin/set_zk_env.sh
new file mode 100644
index 0000000..8f126e3
--- /dev/null
+++ b/MPE/zookeeper/bin/set_zk_env.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+echo -e "\n#zookeeper\nexport ZOOKEEPER_HOME=/data/tsg/olap/zookeeper-3.4.10\nexport PATH=\$ZOOKEEPER_HOME/bin:\$PATH" >> /etc/profile.d/zookeeper.sh
+chmod +x /etc/profile.d/zookeeper.sh
+
+keeppsth='/etc/init.d/keepzkalive'
+if [ -x $keeppsth ];then
+ chkconfig --add keepzkalive
+ chkconfig keepzkalive on
+ service keepzkalive start && sleep 5
+ zk_dae=`ps -ef | grep dae-zookeeper.sh | grep -v grep | wc -l`
+ if [ $zk_dae -eq "0" ];then
+ nohup /data/tsg/olap/zookeeper-3.4.10/bin/dae-zookeeper.sh > /dev/null 2>&1 &
+ fi
+fi
+
diff --git a/MPE/zookeeper/bin/zkCleanup.sh b/MPE/zookeeper/bin/zkCleanup.sh
new file mode 100644
index 0000000..38ee2e8
--- /dev/null
+++ b/MPE/zookeeper/bin/zkCleanup.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# This script cleans up old transaction logs and snapshots
+#
+
+#
+# If this scripted is run out of /usr/bin or some other system bin directory
+# it should be linked to and not copied. Things like java jar files are found
+# relative to the canonical path of this script.
+#
+
+# use POSTIX interface, symlink is followed automatically
+ZOOBIN="${BASH_SOURCE-$0}"
+ZOOBIN="$(dirname "${ZOOBIN}")"
+ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"
+
+if [ -e "$ZOOBIN/../libexec/zkEnv.sh" ]; then
+ . "$ZOOBINDIR"/../libexec/zkEnv.sh
+else
+ . "$ZOOBINDIR"/zkEnv.sh
+fi
+
+ZOODATADIR="$(grep "^[[:space:]]*dataDir=" "$ZOOCFG" | sed -e 's/.*=//')"
+ZOODATALOGDIR="$(grep "^[[:space:]]*dataLogDir=" "$ZOOCFG" | sed -e 's/.*=//')"
+
+if [ "x$ZOODATALOGDIR" = "x" ]
+then
+"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS \
+ org.apache.zookeeper.server.PurgeTxnLog "$ZOODATADIR" $*
+else
+"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS \
+ org.apache.zookeeper.server.PurgeTxnLog "$ZOODATALOGDIR" "$ZOODATADIR" $*
+fi
diff --git a/MPE/zookeeper/bin/zkCli.cmd b/MPE/zookeeper/bin/zkCli.cmd
new file mode 100644
index 0000000..0ffa030
--- /dev/null
+++ b/MPE/zookeeper/bin/zkCli.cmd
@@ -0,0 +1,24 @@
+@echo off
+REM Licensed to the Apache Software Foundation (ASF) under one or more
+REM contributor license agreements. See the NOTICE file distributed with
+REM this work for additional information regarding copyright ownership.
+REM The ASF licenses this file to You under the Apache License, Version 2.0
+REM (the "License"); you may not use this file except in compliance with
+REM the License. You may obtain a copy of the License at
+REM
+REM http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing, software
+REM distributed under the License is distributed on an "AS IS" BASIS,
+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+REM See the License for the specific language governing permissions and
+REM limitations under the License.
+
+setlocal
+call "%~dp0zkEnv.cmd"
+
+set ZOOMAIN=org.apache.zookeeper.ZooKeeperMain
+call %JAVA% "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% %*
+
+endlocal
+
diff --git a/MPE/zookeeper/bin/zkCli.sh b/MPE/zookeeper/bin/zkCli.sh
new file mode 100644
index 0000000..992a913
--- /dev/null
+++ b/MPE/zookeeper/bin/zkCli.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# This script cleans up old transaction logs and snapshots
+#
+
+#
+# If this scripted is run out of /usr/bin or some other system bin directory
+# it should be linked to and not copied. Things like java jar files are found
+# relative to the canonical path of this script.
+#
+
+# use POSTIX interface, symlink is followed automatically
+ZOOBIN="${BASH_SOURCE-$0}"
+ZOOBIN="$(dirname "${ZOOBIN}")"
+ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"
+
+if [ -e "$ZOOBIN/../libexec/zkEnv.sh" ]; then
+ . "$ZOOBINDIR"/../libexec/zkEnv.sh
+else
+ . "$ZOOBINDIR"/zkEnv.sh
+fi
+
+"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS \
+ org.apache.zookeeper.ZooKeeperMain "$@"
diff --git a/MPE/zookeeper/bin/zkEnv.cmd b/MPE/zookeeper/bin/zkEnv.cmd
new file mode 100644
index 0000000..41eed11
--- /dev/null
+++ b/MPE/zookeeper/bin/zkEnv.cmd
@@ -0,0 +1,49 @@
+@echo off
+REM Licensed to the Apache Software Foundation (ASF) under one or more
+REM contributor license agreements. See the NOTICE file distributed with
+REM this work for additional information regarding copyright ownership.
+REM The ASF licenses this file to You under the Apache License, Version 2.0
+REM (the "License"); you may not use this file except in compliance with
+REM the License. You may obtain a copy of the License at
+REM
+REM http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing, software
+REM distributed under the License is distributed on an "AS IS" BASIS,
+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+REM See the License for the specific language governing permissions and
+REM limitations under the License.
+
+set ZOOCFGDIR=%~dp0%..\conf
+set ZOO_LOG_DIR=%~dp0%..
+set ZOO_LOG4J_PROP=INFO,CONSOLE
+
+REM for sanity sake assume Java 1.6
+REM see: http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html
+
+REM add the zoocfg dir to classpath
+set CLASSPATH=%ZOOCFGDIR%
+
+REM make it work in the release
+SET CLASSPATH=%~dp0..\*;%~dp0..\lib\*;%CLASSPATH%
+
+REM make it work for developers
+SET CLASSPATH=%~dp0..\build\classes;%~dp0..\build\lib\*;%CLASSPATH%
+
+set ZOOCFG=%ZOOCFGDIR%\zoo.cfg
+
+@REM setup java environment variables
+
+if not defined JAVA_HOME (
+ echo Error: JAVA_HOME is not set.
+ goto :eof
+)
+
+set JAVA_HOME=%JAVA_HOME:"=%
+
+if not exist "%JAVA_HOME%"\bin\java.exe (
+ echo Error: JAVA_HOME is incorrectly set.
+ goto :eof
+)
+
+set JAVA="%JAVA_HOME%"\bin\java
diff --git a/MPE/zookeeper/bin/zkEnv.sh b/MPE/zookeeper/bin/zkEnv.sh
new file mode 100644
index 0000000..273be21
--- /dev/null
+++ b/MPE/zookeeper/bin/zkEnv.sh
@@ -0,0 +1,116 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This script should be sourced into other zookeeper
+# scripts to setup the env variables
+
+# We use ZOOCFGDIR if defined,
+# otherwise we use /etc/zookeeper
+# or the conf directory that is
+# a sibling of this script's directory
+
+ZOOBINDIR="${ZOOBINDIR:-/usr/bin}"
+ZOOKEEPER_PREFIX="${ZOOBINDIR}/.."
+
+if [ "x$ZOOCFGDIR" = "x" ]
+then
+ if [ -e "${ZOOKEEPER_PREFIX}/conf" ]; then
+ ZOOCFGDIR="$ZOOBINDIR/../conf"
+ else
+ ZOOCFGDIR="$ZOOBINDIR/../etc/zookeeper"
+ fi
+fi
+
+if [ -f "${ZOOCFGDIR}/zookeeper-env.sh" ]; then
+ . "${ZOOCFGDIR}/zookeeper-env.sh"
+fi
+
+if [ "x$ZOOCFG" = "x" ]
+then
+ ZOOCFG="zoo.cfg"
+fi
+
+ZOOCFG="$ZOOCFGDIR/$ZOOCFG"
+
+if [ -f "$ZOOCFGDIR/java.env" ]
+then
+ . "$ZOOCFGDIR/java.env"
+fi
+
+if [ "x${ZOO_LOG_DIR}" = "x" ]
+then
+ ZOO_LOG_DIR="${ZOOKEEPER_PREFIX}/logs/system"
+fi
+
+if [ "x${ZOO_LOG4J_PROP}" = "x" ]
+then
+ #ZOO_LOG4J_PROP="INFO,CONSOLE"
+ ZOO_LOG4J_PROP="ERROR,ROLLINGFILE"
+fi
+
+if [ "$JAVA_HOME" != "" ]; then
+ JAVA="$JAVA_HOME/bin/java"
+else
+ JAVA=java
+fi
+
+#add the zoocfg dir to classpath
+CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
+
+for i in "$ZOOBINDIR"/../src/java/lib/*.jar
+do
+ CLASSPATH="$i:$CLASSPATH"
+done
+
+#make it work in the binary package
+#(use array for LIBPATH to account for spaces within wildcard expansion)
+if [ -e "${ZOOKEEPER_PREFIX}"/share/zookeeper/zookeeper-*.jar ]; then
+ LIBPATH=("${ZOOKEEPER_PREFIX}"/share/zookeeper/*.jar)
+else
+ #release tarball format
+ for i in "$ZOOBINDIR"/../zookeeper-*.jar
+ do
+ CLASSPATH="$i:$CLASSPATH"
+ done
+ LIBPATH=("${ZOOBINDIR}"/../lib/*.jar)
+fi
+
+for i in "${LIBPATH[@]}"
+do
+ CLASSPATH="$i:$CLASSPATH"
+done
+
+#make it work for developers
+for d in "$ZOOBINDIR"/../build/lib/*.jar
+do
+ CLASSPATH="$d:$CLASSPATH"
+done
+
+#make it work for developers
+CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH"
+
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ *) cygwin=false ;;
+esac
+
+if $cygwin
+then
+ CLASSPATH=`cygpath -wp "$CLASSPATH"`
+fi
+
+#echo "CLASSPATH=$CLASSPATH"
diff --git a/MPE/zookeeper/bin/zkServer.cmd b/MPE/zookeeper/bin/zkServer.cmd
new file mode 100644
index 0000000..6b4cf02
--- /dev/null
+++ b/MPE/zookeeper/bin/zkServer.cmd
@@ -0,0 +1,24 @@
+@echo off
+REM Licensed to the Apache Software Foundation (ASF) under one or more
+REM contributor license agreements. See the NOTICE file distributed with
+REM this work for additional information regarding copyright ownership.
+REM The ASF licenses this file to You under the Apache License, Version 2.0
+REM (the "License"); you may not use this file except in compliance with
+REM the License. You may obtain a copy of the License at
+REM
+REM http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing, software
+REM distributed under the License is distributed on an "AS IS" BASIS,
+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+REM See the License for the specific language governing permissions and
+REM limitations under the License.
+
+setlocal
+call "%~dp0zkEnv.cmd"
+
+set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
+echo on
+call %JAVA% "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*
+
+endlocal
diff --git a/MPE/zookeeper/bin/zkServer.sh b/MPE/zookeeper/bin/zkServer.sh
new file mode 100644
index 0000000..396aedd
--- /dev/null
+++ b/MPE/zookeeper/bin/zkServer.sh
@@ -0,0 +1,225 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# If this scripted is run out of /usr/bin or some other system bin directory
+# it should be linked to and not copied. Things like java jar files are found
+# relative to the canonical path of this script.
+#
+
+
+
+# use POSTIX interface, symlink is followed automatically
+ZOOBIN="${BASH_SOURCE-$0}"
+ZOOBIN="$(dirname "${ZOOBIN}")"
+ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"
+
+if [ -e "$ZOOBIN/../libexec/zkEnv.sh" ]; then
+ . "$ZOOBINDIR/../libexec/zkEnv.sh"
+else
+ . "$ZOOBINDIR/zkEnv.sh"
+fi
+
+# See the following page for extensive details on setting
+# up the JVM to accept JMX remote management:
+# http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html
+# by default we allow local JMX connections
+if [ "x$JMXLOCALONLY" = "x" ]
+then
+ JMXLOCALONLY=false
+fi
+
+if [ "x$JMXDISABLE" = "x" ] || [ "$JMXDISABLE" = 'false' ]
+then
+ echo "ZooKeeper JMX enabled by default" >&2
+ if [ "x$JMXPORT" = "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
+ if [ "x$JMXAUTH" = "x" ]
+ then
+ JMXAUTH=false
+ fi
+ if [ "x$JMXSSL" = "x" ]
+ then
+ JMXSSL=false
+ fi
+ if [ "x$JMXLOG4J" = "x" ]
+ then
+ JMXLOG4J=true
+ fi
+ echo "ZooKeeper remote JMX Port set to $JMXPORT" >&2
+ echo "ZooKeeper remote JMX authenticate set to $JMXAUTH" >&2
+ echo "ZooKeeper remote JMX ssl set to $JMXSSL" >&2
+ echo "ZooKeeper remote JMX log4j set to $JMXLOG4J" >&2
+ ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMXPORT -Dcom.sun.management.jmxremote.authenticate=$JMXAUTH -Dcom.sun.management.jmxremote.ssl=$JMXSSL -Dzookeeper.jmx.log4j.disable=$JMXLOG4J org.apache.zookeeper.server.quorum.QuorumPeerMain"
+ fi
+else
+ echo "JMX disabled by user request" >&2
+ ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
+fi
+
+if [ "x$SERVER_JVMFLAGS" != "x" ]
+then
+ JVMFLAGS="$SERVER_JVMFLAGS $JVMFLAGS"
+fi
+
+if [ "x$2" != "x" ]
+then
+ ZOOCFG="$ZOOCFGDIR/$2"
+fi
+
+# if we give a more complicated path to the config, don't screw around in $ZOOCFGDIR
+if [ "x$(dirname "$ZOOCFG")" != "x$ZOOCFGDIR" ]
+then
+ ZOOCFG="$2"
+fi
+
+if $cygwin
+then
+ ZOOCFG=`cygpath -wp "$ZOOCFG"`
+ # cygwin has a "kill" in the shell itself, gets confused
+ KILL=/bin/kill
+else
+ KILL=kill
+fi
+
+echo "Using config: $ZOOCFG" >&2
+
+case "$OSTYPE" in
+*solaris*)
+ GREP=/usr/xpg4/bin/grep
+ ;;
+*)
+ GREP=grep
+ ;;
+esac
+if [ -z "$ZOOPIDFILE" ]; then
+ ZOO_DATADIR="$($GREP "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//')"
+ if [ ! -d "$ZOO_DATADIR" ]; then
+ mkdir -p "$ZOO_DATADIR"
+ fi
+ ZOOPIDFILE="$ZOO_DATADIR/zookeeper_server.pid"
+else
+ # ensure it exists, otw stop will fail
+ mkdir -p "$(dirname "$ZOOPIDFILE")"
+fi
+
+if [ ! -w "$ZOO_LOG_DIR" ] ; then
+mkdir -p "$ZOO_LOG_DIR"
+fi
+
+_ZOO_DAEMON_OUT="$ZOO_LOG_DIR/zookeeper.log"
+
+case $1 in
+start)
+ echo -n "Starting zookeeper ... "
+ if [ -f "$ZOOPIDFILE" ]; then
+ if kill -0 `cat "$ZOOPIDFILE"` > /dev/null 2>&1; then
+ echo $command already running as process `cat "$ZOOPIDFILE"`.
+ exit 0
+ fi
+ fi
+ nohup "$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" > "$_ZOO_DAEMON_OUT" 2>&1 < /dev/null &
+ if [ $? -eq 0 ]
+ then
+ case "$OSTYPE" in
+ *solaris*)
+ /bin/echo "${!}\\c" > "$ZOOPIDFILE"
+ ;;
+ *)
+ /bin/echo -n $! > "$ZOOPIDFILE"
+ ;;
+ esac
+ if [ $? -eq 0 ];
+ then
+ sleep 1
+ echo STARTED
+ else
+ echo FAILED TO WRITE PID
+ exit 1
+ fi
+ else
+ echo SERVER DID NOT START
+ exit 1
+ fi
+ ;;
+start-foreground)
+ ZOO_CMD=(exec "$JAVA")
+ if [ "${ZOO_NOEXEC}" != "" ]; then
+ ZOO_CMD=("$JAVA")
+ fi
+ "${ZOO_CMD[@]}" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG"
+ ;;
+print-cmd)
+ echo "\"$JAVA\" -Dzookeeper.log.dir=\"${ZOO_LOG_DIR}\" -Dzookeeper.root.logger=\"${ZOO_LOG4J_PROP}\" -cp \"$CLASSPATH\" $JVMFLAGS $ZOOMAIN \"$ZOOCFG\" > \"$_ZOO_DAEMON_OUT\" 2>&1 < /dev/null"
+ ;;
+stop)
+ echo -n "Stopping zookeeper ... "
+ if [ ! -f "$ZOOPIDFILE" ]
+ then
+ echo "no zookeeper to stop (could not find file $ZOOPIDFILE)"
+ else
+ $KILL -9 $(cat "$ZOOPIDFILE")
+ rm "$ZOOPIDFILE"
+ echo STOPPED
+ fi
+ exit 0
+ ;;
+upgrade)
+ shift
+ echo "upgrading the servers to 3.*"
+ "$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.server.upgrade.UpgradeMain ${@}
+ echo "Upgrading ... "
+ ;;
+restart)
+ shift
+ "$0" stop ${@}
+ sleep 3
+ "$0" start ${@}
+ ;;
+status)
+ # -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output
+ clientPortAddress=`$GREP "^[[:space:]]*clientPortAddress[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'`
+ if ! [ $clientPortAddress ]
+ then
+ clientPortAddress="localhost"
+ fi
+ clientPort=`$GREP "^[[:space:]]*clientPort[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'`
+ STAT=`"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+ -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain \
+ $clientPortAddress $clientPort srvr 2> /dev/null \
+ | $GREP Mode`
+ if [ "x$STAT" = "x" ]
+ then
+ echo "Error contacting service. It is probably not running."
+ exit 1
+ else
+ echo $STAT
+ exit 0
+ fi
+ ;;
+*)
+ echo "Usage: $0 {start|start-foreground|stop|restart|status|upgrade|print-cmd}" >&2
+
+esac
diff --git a/MPE/zookeeper/bin/zklogdelete.sh b/MPE/zookeeper/bin/zklogdelete.sh
new file mode 100644
index 0000000..ec85406
--- /dev/null
+++ b/MPE/zookeeper/bin/zklogdelete.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#只保留最近三天的日志,如需要多保留几天修改最后 -n days
+#将此脚本加载到系统定时任务中 /etc/crontab
+#脚本会读取环境变量,固需要配置环境变量。
+source /etc/profile
+day=$(date +"%Y-%m-%d" -d "-7 days")
+
+zk=`jps | grep QuorumPeerMain | wc -l`
+if [[ $zk = "1" ]];then
+ rm -rf $ZOOKEEPER_HOME/logs/system/*.$day*
+fi
+
+kafka=`jps | grep Kafka | wc -l`
+if [[ $kafka = "1" ]];then
+ rm -rf $KAFKA_HOME/logs/*.$day*
+fi
+
diff --git a/MPE/zookeeper/conf/configuration.xsl b/MPE/zookeeper/conf/configuration.xsl
new file mode 100644
index 0000000..377cdbe
--- /dev/null
+++ b/MPE/zookeeper/conf/configuration.xsl
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output method="html"/>
+<xsl:template match="configuration">
+<html>
+<body>
+<table border="1">
+<tr>
+ <td>name</td>
+ <td>value</td>
+ <td>description</td>
+</tr>
+<xsl:for-each select="property">
+<tr>
+ <td><a name="{name}"><xsl:value-of select="name"/></a></td>
+ <td><xsl:value-of select="value"/></td>
+ <td><xsl:value-of select="description"/></td>
+</tr>
+</xsl:for-each>
+</table>
+</body>
+</html>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/MPE/zookeeper/conf/java.env b/MPE/zookeeper/conf/java.env
new file mode 100644
index 0000000..4c70fdb
--- /dev/null
+++ b/MPE/zookeeper/conf/java.env
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_73
+# heap size MUST be modified according to cluster environment
+
+export JVMFLAGS="-Xmx4096m -Xms1024m $JVMFLAGS"
diff --git a/MPE/zookeeper/conf/log4j.properties b/MPE/zookeeper/conf/log4j.properties
new file mode 100644
index 0000000..30d6d7b
--- /dev/null
+++ b/MPE/zookeeper/conf/log4j.properties
@@ -0,0 +1,63 @@
+# Define some default values that can be overridden by system properties
+#zookeeper.root.logger=INFO, CONSOLE
+zookeeper.root.logger=ERROR, ROLLINGFILE
+zookeeper.console.threshold=ERROR
+zookeeper.log.dir=.
+zookeeper.log.file=zookeeper.log
+zookeeper.log.threshold=ERROR
+zookeeper.tracelog.dir=.
+zookeeper.tracelog.file=zookeeper_trace.log
+
+#
+# ZooKeeper Logging Configuration
+#
+
+# Format is "<default threshold> (, <appender>)+
+
+# DEFAULT: console appender only
+log4j.rootLogger=${zookeeper.root.logger}
+
+# 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=${zookeeper.console.threshold}
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ssZ}{UTC} [myid:%X{myid}] - %-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=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.ROLLINGFILE.Threshold=${zookeeper.log.threshold}
+log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/${zookeeper.log.file}
+log4j.appender.ROLLINGFILE.DataPattern='.'yyyy-MM-dd-HH
+log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.ROLLINGFILE.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ssZ}{UTC}] %p %m (%c)%n
+
+# 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{yyyy-MM-dd HH:mm:ssZ}{UTC} [myid:%X{myid}] - %-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=${zookeeper.tracelog.dir}/${zookeeper.tracelog.file}
+
+log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout
+### Notice we are including log4j's NDC here (%x)
+log4j.appender.TRACEFILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ssZ}{UTC} [myid:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n
diff --git a/MPE/zookeeper/conf/zoo.cfg b/MPE/zookeeper/conf/zoo.cfg
new file mode 100644
index 0000000..36f1eb3
--- /dev/null
+++ b/MPE/zookeeper/conf/zoo.cfg
@@ -0,0 +1,51 @@
+# The number of milliseconds of each tick
+# Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。tickTime以毫秒为单位。
+tickTime=9000
+
+# The number of ticks that the initial synchronization phase can take
+# 集群中的follower服务器(F)与leader服务器(L)之间初始连接时能容忍的最多心跳数(tickTime的数量)。
+initLimit=10
+
+# The number of ticks that can pass between sending a request and getting an acknowledgement
+# 集群中的follower服务器与leader服务器之间请求和应答之间能容忍的最多心跳数(tickTime的数量)。
+syncLimit=5
+
+#ZooKeeper将会对客户端进行限流,系统中未处理的请求数量不超过设置的值。(default:1000)
+globalOutstandingLimit=1000
+
+# the maximum number of client connections.increase this if you need to handle more clients
+# socket级别限制单个客户端到ZooKeeper集群中单台服务器的并发连接数量.(default:60)
+maxClientCnxns=5000
+
+#忽略ACL验证,可以减少权限验证的相关操作,提升性能
+skipACL=yes
+
+#yes:每次写请求的数据都要从pagecache中固化到磁盘上,才算成功返回.后续写请求会等待前面写请求.
+#no:数据写到pagecache后就返回,提升性能,但是机器断电的时候,pagecache中的数据有可能丢失。
+forceSync=yes
+
+#当事务日志(WAL)中的fsync时间超过此值时,将向日志输出警告消息,需要forceSync为yes。
+fsync.warningthresholdms=20
+
+# the directory where the snapshot is stored.
+# do not use /tmp for storage, /tmp here is just example sakes.
+# Zookeeper保存数据的目录,默认情况下,Zookeeper将写数据的日志文件也保存在这个目录里。
+dataDir=/data/tsg/olap/zookeeper-3.4.10/data
+
+#Zookeeper保存日志文件的目录。
+dataLogDir=/data/tsg/olap/zookeeper-3.4.10/logs
+
+# the port at which the clients will connect
+#客户端连接 Zookeeper 服务器的端口
+clientPort=2181
+
+#指定需要保留的文件数目(default:3)
+autopurge.snapRetainCount=3
+
+#指定清理频率,单位为小时(default:0 表示不开启自动清理)
+autopurge.purgeInterval=1
+
+#the servers
+server.1=192.168.20.221:2888:3888
+server.2=192.168.20.222:2888:3888
+server.3=192.168.20.223:2888:3888
diff --git a/MPE/zookeeper/conf/zoo_sample.cfg b/MPE/zookeeper/conf/zoo_sample.cfg
new file mode 100644
index 0000000..a5a2c0b
--- /dev/null
+++ b/MPE/zookeeper/conf/zoo_sample.cfg
@@ -0,0 +1,28 @@
+# 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=/tmp/zookeeper
+# the port at which the clients will connect
+clientPort=2181
+# the maximum number of client connections.
+# increase this if you need to handle more clients
+#maxClientCnxns=60
+#
+# 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