1.挑选3台主机
s201 ~ s203
2.每台机器都安装zk
tar
环境变量
export ZOOKEEPER_HOME=/soft/zk
export PATH=$PATH:$ZOOKEEPER_HOME/bin
3.配置zk配置文件
s201 ~ s203
[/soft/zk/conf/zoo.cfg]
...
dataDir=/home/centos/zookeeper
server.1=s201:2888:3888
server.2=s202:2888:3888
server.3=s203:2888:3888
4.在每台主机的/home/centos/zookeeper中添加myid,内容分别是1,2,3
[s201]
$>echo 1 > /home/centos/zookeeper/myid
[s202]
$>echo 2 > /home/centos/zookeeper/myid
[s203]
$>echo 3 > /home/centos/zookeeper/myid
5.启动服务器集群
$>zkServer.sh start
s201~s203
6.查看每台服务器的状态
$>zkServer.sh status
7.修改zk的log目录
[/soft/zk/conf/log4j.properties]
zookeeper.root.logger=INFO, CONSOLE
zookeeper.console.threshold=INFO
zookeeper.log.dir=/home/admin/zookeeper/log
zookeeper.log.file=zookeeper.log
zookeeper.log.threshold=DEBUG
zookeeper.tracelog.dir=/home/admin/zookeeper/log