The Zookeeper installation package we downloaded is in. tar.gz format, but can still be run under Windows.
http://mirrors.hust.edu.cn/apache/zookeeper/
Download the version under the stable path
Extract the downloaded zookeeper files to the specified directory
C:\zookeeper-3.4.6
Zookeeper configuration file in the Conf directory, this directory has zoo_sample.cfg and log4j.properties, what you need to do is to rename Zoo_sample.cfg zoo.cfg, because Zookeeper at startup will Find this file as the default profile.
Configure Zoo.cfg
# The number of milliseconds of each tickticktime=2000# the number of ticks, the initial # synchronization phase can T akeinitlimit=10# the number of ticks so can pass between # Sending a request and getting an acknowledgementsynclimit=5# The directory where the snapshot is stored.# does not use/tmp for storage,/tmp here is just # example sakes.Datadir=c:\\zookeeper\\datadatalogdir=c:\\zookeeper\\log# The port at which the clients would connectclientport=2181# the maximum number of the client connections.# increase this if y ou need to handle more clients#maxclientcnxns=60## is sure to read the maintenance sections of the The # Administrator guide is Fore 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 PU Rge feature#autopurge.purgeinterval=1
server.1=127.0.0.1:2888:3888
- Ticktime: This time is the time interval between the Zookeeper server or between the client and the server to maintain the heartbeat, that is, each ticktime time sends a heartbeat.
- DataDir: As the name implies is Zookeeper to save the data directory, by default, Zookeeper will write the data log file is also stored in this directory.
- Datalogdir: As the name implies Zookeeper the directory where the log files are saved
- ClientPort: This port is the port that the client connects to the Zookeeper server, Zookeeper listens to the port and accepts the client's access request.
When these configuration items are configured, you can start Zookeeper now, after starting to check whether Zookeeper is already in service, you can check with the Netstat–ano command to see if there is a ClientPort port number you configured in the Listening service.
Using the DOS window to open the service, directly into the bin directory double-click Start there will be problems, do not understand
Go to the Bin directory and start Zkserver.cmd, this script will start a Java process
After startup JPs can see the quorumpeermain process
Start the client run and see for yourself
To verify that the service is started, use the Telnet command
then enter stat
Installing zookeeper in the Windows environment