zookeeper 安装 windows环境,伪集群配置

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

 

转载于:https://my.oschina.net/u/2764409/blog/685182

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值