zookeeper3.3.6,windows7下的安装配置
下载地址
http://pan.baidu.com/s/1pLF1zoJ
1、单机运行
下载zookeeper后,解压,找到conf下面的zoo_sample.cfg,复制一份,重命名为zoo.cfg,就可以运行了
2、伪集群配置
1、到bin目录下,复制三份zkServer.cmd这个文件,分别命名为:zkServer1.cmd、zkServer2.cmd、zkServer3.cmd
zkServer1.cmd的里面内容的修改
在此下面call "%~dp0zkEnv.cmd"
添加
set ZOOCFG=%ZOOCFGDIR%\zoo1.cfg
zkServer2.cmd的里面内容的修改
在此下面call "%~dp0zkEnv.cmd"
添加
set ZOOCFG=%ZOOCFGDIR%\zoo2.cfg
zkServer3.cmd的里面内容的修改
在此下面call "%~dp0zkEnv.cmd"
添加
set ZOOCFG=%ZOOCFGDIR%\zoo3.cfg
解释:ZOOCFG,此属性是用于加载zookerper的配置信息
2、在conf目录中,复制三份zoo_sample.cfg文件,分别命名为zoo1.cfg、zoo2.cfg、zoo3.cfg
zoo1.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.
dataDir=E:\\20160519\\zookeeper-3.3.6\\tmp\\zookeeper1
# the port at which the clients will connect
clientPort=2182
server.1=127.0.0.1:2887:3887
server.2=127.0.0.1:2888:3888
server.3=127.0.0.1:2889:3889
zoo2.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.
dataDir=E:\\20160519\\zookeeper-3.3.6\\tmp\\zookeeper2
# the port at which the clients will connect
clientPort=2183
server.1=127.0.0.1:2887:3887
server.2=127.0.0.1:2888:3888
server.3=127.0.0.1:2889:3889
zoo3.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.
dataDir=E:\\20160519\\zookeeper-3.3.6\\tmp\\zookeeper3
# the port at which the clients will connect
clientPort=2184
server.1=127.0.0.1:2887:3887
server.2=127.0.0.1:2888:3888
server.3=127.0.0.1:2889:3889
(备注:其中dataDir,为集群配置时要找的识别自己的配置文件路径;clientPort,为客户端的端口。server.1,以及server.2,server.3为集群中其他的地址以及端口)
此处需注意:127.0.0.1,为伪集群的地址,不能为localhost,需注意
3、在第二步配置的dataDir对应的目录中,分别建立一个名字为myid的文件
myid文件的内容,分别为1,2,3;三个数字,至此配置,就可以启动成功了。
里面的各个配置项中的关联关系,自己慢慢体会吧!
最后附上一份配置成功的三个伪集群
http://pan.baidu.com/s/1dFNTsLr