1、在apache的官方网站提供了好多镜像下载地址,然后找到对应的版本,目前最新的是3.4.6
下载地址:http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
2、把下载的zookeeper的文件解压到指定目录
D:\Program Files\zookeeper-3.4.6>
3、新建zookeeper data和logs目录
D:\Program Files\zookeeper-3.4.6\data
D:\Program Files\zookeeper-3.4.6\logs
4、复制conf下配置样例文件zoo_sample.cfg 增加一个zoo.cfg
内容如下:
# 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 anacknowledgement
syncLimit=5
# the directory where the snapshot isstored. //镜像数据位置
dataDir=D:\\Program Files\\zookeeper-3.4.6\\data
#日志位置
dataLogDir=D:\\Program Files\\zookeeper-3.4.6\\logs
# the port at which the clients willconnect 客户端连接的端口
clientPort=2181
注:如果启动有报错提示cfg文件有错误,可以用zoo_sample.cfg内内容替代也是可以的
5、进入到bin目录,并且启动zkServer.cmd,这个脚本中会启动一个java进程
D:\Program Files\zookeeper-3.4.6>cd bin
D:\Program Files\zookeeper-3.4.6\bin >zkServer.cmd
6、启动后,jps验证是否存在QuorumPeerMain进程
D:\Program Files\zookeeper-3.4.6\bin >jps
7、启动客户端验证zookeeper是否已安装成功
D:\Program Files\zookeeper-3.4.6\bin>zkCli.cmd-server 127.0.0.1:2181