标签:
我们下载下来的zookeeper的安装包是.tar.gz格式的,但是还是可以在windows下运行。
下载地址 http://mirrors.hust.edu.cn/apache/zookeeper/
下载stable路径下的版本
把下载的zookeeper的文件解压到指定目录
C:\zookeeper-3.4.6
Zookeeper 的配置文件在 conf 目录下,这个目录下有 zoo_sample.cfg 和 log4j.properties,你需要做的就是将 zoo_sample.cfg 改名为 zoo.cfg,因为 Zookeeper 在启动时会找这个文件作为默认配置文件。
配置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 an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=C:\\zookeeper\\data
dataLogDir=C:\\zookeeper\\log
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=127.0.0.1:2888:3888
当这些配置项配置好后,你现在就可以启动 Zookeeper 了,启动后要检查 Zookeeper 是否已经在服务,可以通过 netstat – ano 命令查看是否有你配置的 clientPort 端口号在监听服务。
使用DOS窗口开启服务,直接进bin目录双击启动会有问题,不明白
进入到bin目录,并且启动zkServer.cmd,这个脚本中会启动一个Java进程
启动后jps可以看到QuorumPeerMain的进程
启动客户端运行查看一下
验证服务是否启动,使用telnet命令
然后输入stat
标签:
原文地址:http://www.cnblogs.com/winner-0715/p/5508500.html