下载zookeeper,http://archive.apache.org/dist/zookeeper/
解压到: /opt/zookeeper-3.4.6下载
把conf下的zoo_sample.cfg copy一份后重命名为: zoo.cfg.文件中内容如下:
syncLimit=5
initLimit=10
tickTime=2000
clientPort=2181
dataDir=/opt/zookeeper-3.4.6/data
dataLogDir=/opt/zookeeper-3.4.6/logs新建zookeeper-3.4.6下的data,log目录,然后
chmod u+x /opt/zookeeper-3.4.6/bin/*-
新建shell脚本startZookeeper.sh在/opt/shell文件夹下,
内容:
#!/bin/sh
#to start zookeeper
#set environment
export ZOOKEEPER_INSTALL=/opt/zookeeper-3.4.6
export PATH=$PATH:$ZOOKEEPER_INSTALL/bin
PID_FILE=$ZOOKEEPER_INSTALL/data/zookeeper_server.pid
FLAG=$1if [ "$FLAG" = "os_start" ] && [ -f "$PID_FILE" ]
thenrm $PID_FILE
fi
chmod u+x /opt/shell/startZookeeper.sh
#start zookeeper
$ZOOKEEPER_INSTALL/bin/zkServer.sh start 设置zookeeper开机启动
vim /etc/rc.local
在最后一行添加如下两句话
#start zookeeper
/opt/shell/startZookeeper.sh
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。