[[email protected] zookeeper]# cd /etc/init.d
[[email protected] init.d]# cat zookeeper
#!/bin/bash
#chkconfig: 2345 10 90
#description: service zookeeper
export JAVA_HOME=/opt/jdk
export ZOO_LOG_DIR=/home/bb/zookeeper/log ##zookeeper的配置文件的dataLogDir
date >>/tmp/zk.log
ZOOKEEPER_HOME=/home/cloud/zookeeper
su - cloud ${ZOOKEEPER_HOME}/bin/zkServer.sh "$1"
echo $1 >>/tmp/zk.log
[[email protected]=bb init.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=/home/bb/zookeeper/
dataLogDir=/home/bb/zookeeper/log/
# the port at which the clients will connect
clientPort=2182
# 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
server.1=172.16.4.26:2888:38888
server.2=172.16.4.27:2888:38888
server.3=172.16.4.28:2888:38888
cd /etc/init.d/
chmod +x zookeeper
chkconfig -add zookeeper
chkconfig zookeeper on
原文地址:http://blog.51cto.com/wsxxsl/2105274