cestos7安装zookeeper
zookeeper安装包下载地址http://archive.apache.org/dist/zookeeper/
一、单机
在/usr目录下
curl -L-O http://archive.apache.org/dist/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
tar -zxf zookeeper-3.4.5.tar.gz
在主目录下创建data和logs两个目录用于存储数据和日志:
cd /usr/myapp/zookeeper-3.4.5
mkdir data mkdir logs
在conf目录下新建zoo.cfg文件,写入以下内容保存:
tickTime=2000 dataDir=/usr/myapp/zookeeper-3.4.5/data dataLogDir=/usr/myapp/zookeeper-3.4.5/logs clientPort=2181
进入bin目录,启动、停止、重启分和查看当前节点状态(包括集群中是何角色)别执行:
./zkServer.sh start ./zkServer.sh stop ./zkServer.sh restart
./zkServer.sh status
启动脚本
#!/bin/sh
ZOOKEEPER_HOME=/usr/zookeeper
ZOOKEEPER_BIN=${ZOOKEEPER_HOME}/bincase "$1" in
start)
${ZOOKEEPER_BIN}/zkServer.sh start
;;
stop)
${ZOOKEEPER_BIN}/zkServer.sh stop
;;
esac