首页 > 代码库 > 配置ZooKeeper集群

配置ZooKeeper集群

配置ZooKeeper集群(Windows环境下) 
1、解压三个zookeeper目录 
D:\zookeeper\zookeeper-1 
D:\zookeeper\zookeeper-2 
D:\zookeeper\zookeeper-3 

2、在这3个目录下面建立data和log目录,并在data目录下面新建myid文件 
myid的文件内容分别为:1、2、3 

3、在conf目录下面复制zoo_sample.cfg文件为zoo.cfg文件 

4、修改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. 
dataDir=D:\\zookeeper\\zookeeper-1\\data 
# the directory where the log 
dataLogDir=D:\\zookeeper\\zookeeper-1\\log 
# the port at which the clients will connect 
clientPort=2181 
#Clusters 
server.1=10.10.15.48:2888:3888 
server.2=10.10.15.48:2889:3889 
server.3=10.10.15.48:2890:3890 

配置ZooKeeper集群