1.简述
环境是winserver
server端版本号是3.4.9
由于服务器申请不下来,采用伪集群方案
2.下载安装包
---------server---------
https://pan.baidu.com/s/1cIsK2a0-f7snkBHRAjVH7Q
--------管理端----------
https://pan.baidu.com/s/1GuhnrzAKlRLkGjyTmxM8_Q
-------windows服务安装工具---------
https://pan.baidu.com/s/1DrJV1Qqo0cbwpwBO2IgM1A
3.新建目录结构如下
------server目录---
D:\zookeeper-3.4.9
zookeeper1
zookeeper2
zookeeper3
------数据目录-----
D:\tmp
zookeeper1
zookeeper2
zookeeper3
4.分别解压server到上述三个目录下
5.zookeeper1目录下新建
-------\conf\zoo.cfg---------
# The number of milliseconds of each tick
tickTime=1000
minSessionTimeout=10
maxSessionTimeout=3600
# 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=2
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=D:/tmp/zookeeper1
# the port at which the clients will connect
clientPort=2181
server.1=127.0.0.1:2188:3888
server.2=127.0.0.1:2189:3889
server.3=127.0.0.1:2190:3890
# 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
------\bin\prunsrv.exe---------
-------install.bat------------
prunsrv.exe "//IS//%ZOOKEEPER_SERVICE1%" ^
--DisplayName="Zookeeper (%ZOOKEEPER_SERVICE1%)" ^
--Description="Zookeeper (%ZOOKEEPER_SERVICE1%)" ^
--Startup=auto --StartMode=exe ^
--StartPath=%ZOOKEEPER_HOME1% ^
--StartImage=%ZOOKEEPER_HOME1%\bin\zkServer.cmd ^
--StopPath=%ZOOKEEPER_HOME1%\ ^
--StopImage=%ZOOKEEPER_HOME1%\bin\zkServerStop.cmd ^
--StopMode=exe --StopTimeout=5 ^
--LogPath=%ZOOKEEPER_HOME1%\logs --LogPrefix=zookeeper-wrapper ^
--PidFile=zookeeper.pid --LogLevel=Info --StdOutput=auto --StdError=auto
-------uninstall.bat------------
D:\zookeeper-3.4.9\zookeeper1\bin\prunsrv.exe //DS//%ZOOKEEPER_SERVICE1%
pause
6.zookeeper2目录下新建
-------\conf\zoo.cfg---------
# The number of milliseconds of each tick
tickTime=1000
minSessionTimeout=10
maxSessionTimeout=3600
# 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=2
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=D:/tmp/zookeeper2
# the port at which the clients will connect
clientPort=2182
server.1=127.0.0.1:2188:3888
server.2=127.0.0.1:2189:3889
server.3=127.0.0.1:2190:3890
# 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
------\bin\prunsrv.exe---------
-------install.bat------------
prunsrv.exe "//IS//%ZOOKEEPER_SERVICE2%" ^
--DisplayName="Zookeeper (%ZOOKEEPER_SERVICE2%)" ^
--Description="Zookeeper (%ZOOKEEPER_SERVICE2%)" ^
--Startup=auto --StartMode=exe ^
--StartPath=%ZOOKEEPER_HOME2% ^
--StartImage=%ZOOKEEPER_HOME2%\bin\zkServer.cmd ^
--StopPath=%ZOOKEEPER_HOME2%\ ^
--StopImage=%ZOOKEEPER_HOME2%\bin\zkServerStop.cmd ^
--StopMode=exe --StopTimeout=5 ^
--LogPath=%ZOOKEEPER_HOME2%\logs --LogPrefix=zookeeper-wrapper ^
--PidFile=zookeeper.pid --LogLevel=Info --StdOutput=auto --StdError=auto
-------uninstall.bat-------
D:\zookeeper-3.4.9\zookeeper2\bin\prunsrv.exe //DS//%ZOOKEEPER_SERVICE2%
pause
7.zookeeper3目录下新建
-------\conf\zoo.cfg---------
# The number of milliseconds of each tick
tickTime=1000
minSessionTimeout=10
maxSessionTimeout=3600
# 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=2
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=D:/tmp/zookeeper3
# the port at which the clients will connect
clientPort=2183
server.1=127.0.0.1:2188:3888
server.2=127.0.0.1:2189:3889
server.3=127.0.0.1:2190:3890
# 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
------\bin\prunsrv.exe---------
-------install.bat------------
prunsrv.exe "//IS//%ZOOKEEPER_SERVICE3%" ^
--DisplayName="Zookeeper (%ZOOKEEPER_SERVICE3%)" ^
--Description="Zookeeper (%ZOOKEEPER_SERVICE3%)" ^
--Startup=auto --StartMode=exe ^
--StartPath=%ZOOKEEPER_HOME3% ^
--StartImage=%ZOOKEEPER_HOME3%\bin\zkServer.cmd ^
--StopPath=%ZOOKEEPER_HOME3%\ ^
--StopImage=%ZOOKEEPER_HOME3%\bin\zkServerStop.cmd ^
--StopMode=exe --StopTimeout=5 ^
--LogPath=%ZOOKEEPER_HOME3%\logs --LogPrefix=zookeeper-wrapper ^
--PidFile=zookeeper.pid --LogLevel=Info --StdOutput=auto --StdError=auto
-------uninstall.bat----------
D:\zookeeper-3.4.9\zookeeper3\bin\prunsrv.exe //DS//%ZOOKEEPER_SERVICE3%
pause
8.系统变量新建
ZOOKEEPER_SERVICE1 zookeeper1
ZOOKEEPER_SERVICE2 zookeeper2
ZOOKEEPER_SERVICE3 zookeeper3
ZOOKEEPER_HOME1 D:\zookeeper-3.4.9\zookeeper1
ZOOKEEPER_HOME2 D:\zookeeper-3.4.9\zookeeper2
ZOOKEEPER_HOME3 D:\zookeeper-3.4.9\zookeeper3
9.利用install.bat安装启动三个服务即可
10.使用ZooInspector可以连接到集群