码迷,mamicode.com
首页 > Windows程序 > 详细

windows环境下安装 zookeeper

时间:2016-05-19 15:07:16      阅读:527      评论:0      收藏:0      [点我收藏+]

标签:

我们下载下来的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
  • tickTime:这个时间是作为 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。
  • dataDir:顾名思义就是 Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
  • dataLogDir:顾名思义就是 Zookeeper 保存日志文件的目录
  • clientPort:这个端口就是客户端连接 Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。

当这些配置项配置好后,你现在就可以启动 Zookeeper 了,启动后要检查 Zookeeper 是否已经在服务,可以通过 netstat – ano 命令查看是否有你配置的 clientPort 端口号在监听服务。

使用DOS窗口开启服务,直接进bin目录双击启动会有问题,不明白

进入到bin目录,并且启动zkServer.cmd,这个脚本中会启动一个Java进程

技术分享

启动后jps可以看到QuorumPeerMain的进程

技术分享

启动客户端运行查看一下

技术分享

验证服务是否启动,使用telnet命令

技术分享

技术分享

然后输入stat

技术分享

 

windows环境下安装 zookeeper

标签:

原文地址:http://www.cnblogs.com/winner-0715/p/5508500.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!