The project used to zookeeper, operation and maintenance department to restart the machine, to the project group of people on the scene to maintain, brother said too lazy to the scene, directly zookeeper into service.
First, configure your zookeeper.
Download, unzip (I put it under/usr/zookeeper), configure Zoo.cfg
The ZOO.CFG configuration is as follows:
# 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=/usr/zookeeper
# The port at which the clients'll connect
clientport=2181
Create a directory under/usr/zookeeper logs,mkdir/usr/zookeeper/logs
#cp/usr/zookeeper/zookeeper-3.3.6/bin/zkserver.sh/etc/rc.d/init.d/zookeeper
#cp/usr/zookeeper/zookeeper-3.3.6/bin/zkenv.sh/etc/rc.d/init.d/zkenv
sudo ln-s/etc/rc.d/init.d/zookeeper/usr/zookeeper/zookeeper-3.3.6/bin/zkserver.sh
Edit the/etc/rc.d/init.d/zookeeper and modify it as follows:
#1. Comment out
# only follow symlinks if Readlink supports it
#if readlink-f "$" >/dev/null 2>&1
#then
# zoobin= ' readlink-f ' $ '
#else
# zoobin= "$"
#fi
#2. Zoobinlink point to/etc/rc.d/init.d/zookeeper
Zoobinlink=/etc/rc.d/init.d/zookeeper
#3. Point to/usr/zookeeper/zookeeper-3.3.6/bin
Zoobin=/usr/zookeeper/zookeeper-3.3.6/bin
Zoobindir= $ZOOBIN
#去掉后缀sh
. "$ZOOENVDIR"/zkenv
Modify/usr/zookeeper/zookeeper-3.3.6/bin/zkenv.sh
If ["X$zoocfgdir" = "x"]
Then
If [-D "/etc/zookeeper"]
Then
Zoocfgdir= "/etc/zookeeper"
Else
#ZOOCFGDIR = "$ZOOBINDIR/. /conf "
Zoocfgdir= "$ZOOBIN/. /conf "
Fi
Fi
if ["x${zoo_log_dir}" = "X"]
Then
#ZOO_LOG_DIR = "."
Zoo_log_dir= "$ZOOBIN/. /logs "
Fi
Configure startup level
Ln-s/etc/init.d/zookeeper/etc/rc3.d/k30zookeeper
Ln-s/etc/init.d/zookeeper/etc/rc3.d/s70zookeeper
Ln-s/etc/init.d/zookeeper/etc/rc5.d/k30zookeeper
Ln-s/etc/init.d/zookeeper/etc/rc5.d/s70zookeeper
Add execute permissions for all users
Chmod-f 777/etc/init.d/zookeeper
Chmod-f 777/etc/rc3.d/s70zookeeper
Verify:
Service Zookeeper Start
Service Zookeeper Stop
Service Zookeeper Status