Zookeeper单机单节点配置

OS: CentOS 6.5 [GNU/Linux  2.6.32-504.23.4.el6.x86_64]

Zookeeper版本:zookeeper-3.4.6

1. 下载zookeeper安装包

wget http://mirror.bjtu.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

 

2. 解压

tar -zxf zookeeper-3.4.6.tar.gz

 

3. 修改配置

cd zookeeper-3.4.6

1) .修改日志数据目录为我们自定义的目录

# mv zoo_sample.cfg zoo.cfg

# vim conf/zoo.cfg

修改dataDir=/tmp/zookeeper 为dataDir=/data/opt/logs/zookeeper

2). 防止生产一个zookeeper.out在启动脚本执行目录

#vim bin/zkEnv.sh

找到

if [ "x${ZOO_LOG_DIR}" = "x" ]
then
ZOO_LOG_DIR="."
fi

修改为

ZOOCFGDIR_CUSTORM=/data/opt/logs/zookeeper

if [ "x${ZOO_LOG_DIR}" = "x" ]
then
ZOO_LOG_DIR="$ZOOCFGDIR_CUSTORM"
fi

4. 制作启动服务脚本和停止服务脚本

#touch zk_server_start.sh

内容为:

#!/bin/sh
/data/opt/zookeeper/bin/zkServer.sh start  /data/opt/zookeeper/config/zoo.cfg

#touch zk_server_stop.sh

内容为:

#!/bin/sh
/data/opt/zookeeper/bin/zkServer.sh stop  /data/opt/zookeeper/config/zoo.cfg

 

5. 启动和关闭服务

启动:

# sh zk_server_start.sh

JMX enabled by default
Using config: /data/opt/zookeeper/config/zoo.cfg
Starting zookeeper ... STARTED

查看进程:

#jps

1344 QuorumPeerMain
1363 Jps

关闭:

# sh zk_server_stop.sh

JMX enabled by default
Using config: /data/opt/zookeeper/config/zoo.cfg
Stopping zookeeper ... STOPPED

查看进程,消失

#jps

1387 Jps

 

----------------------------------------

Over !! 

你可能感兴趣的:(zookeeper)