所需的文件下载地址:http://www.apache.org/dyn/closer.cgi/zookeeper/
1. 在windows 下安装的zooKeeper ,所下载的文件 zookeeper-3.3.6.tar.gz 解压到一个文件夹下。如图
目录如图:
然后在对应的zookeeper-3.4.6/conf 下有一个文件zoo_sample.cfg的这个文件里面配置了监听客户端连接的端口等一些信息,Zookeeper 在启动时会找zoo.cfg这个文件作为默认配置文件,所以我们复制一个名称为zoo.cfg的文件,进入conf 修改配置文件 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:\\data\\zookeeper
#日志位置
dataLogDir=D:\\logs\\zookeeper
# the port at which the clients willconnect //客户端连接的端口
clientPort=2181
修改了配置文件dataLogDir 的配置,这个配置地址需要人为的去创建,要不然会报错。 说明:
clientPort:监听客户端连接的端口。
tickTime:基本事件单元,以毫秒为单位。它用来控制心跳和超时,默认情况下最小的会话超时时间为两倍的 tickTime。
进入bin 目录,然后在 dos 下运行。
zookeeper 就启动了,同时可以使用zookeeper 自带的客户端查看一下。如图:
Linux环境下参考:http://liuhu.me/2015/02/16/Dubbo-Study.html