Using apache-zookeeper-3.5.7 under Windows

ZooKeeper is a distributed and open-source coordination service designed for distributed applications. It is mainly used to solve some data management problems often encountered in distributed applications, simplify the coordination and management of distributed applications, and provide high-performance distributed services. ZooKeeper itself can be installed and run in Standalone mode, but its strength lies in the distributed ZooKeeper cluster (one Leader, multiple followers), based on certain strategies to ensure the stability and availability of ZooKeeper cluster, so as to achieve the reliability of distributed applications. ZooKeeper is a distributed coordination service, which does not need to rely on Hadoop environment, but also can provide services for other distributed environments.

zookeeper has three deployment modes: stand-alone, pseudo cluster and cluster. You can choose the appropriate deployment mode according to your own reliability requirements. Next, the three deployment methods are explained one by one.

Install jdk
Install zookeeper. Download zookeeper at http://zookeeper.apache.org/. I downloaded version 3.5.7 of zookeeper.
Unzip apache-zookeeper-3.5.7-bin.tar.gz to D:\zkcluster\apache-zookeeper-3.5.7-bin-01
Create a new data and log directory in D:\zkcluster\apache-zookeeper-3.5.7-bin-01.
There are three installation modes of ZooKeeper: stand alone mode, cluster mode and cluster pseudo distribution mode. The installation of ZooKeeper single machine mode is relatively simple. If you contact ZooKeeper for the first time, it is recommended to install ZooKeeper single machine mode or cluster pseudo distribution mode.

Install click mode. Go to D:\zkcluster\apache-zookeeper-3.5.7-bin-01\conf copy zoo_sample.cfg and paste it into the current directory, name zoo.cfg

# The number of milliseconds of each tick
tickTime=6000
# 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.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=D:\\zkcluster\\apache-zookeeper-3.5.7-bin-01\\data
dataLogDir=D:\\zkcluster\\apache-zookeeper-3.5.7-bin-01\\log
# the port at which the clients will connect
clientPort=5181

Under the command of CMD, run zkserver.cmd in the directory D:\zkcluster\apache-zookeeper-3.5.7-bin-01\bin

After startup, under the cmd command, netstat ano views the port listening service.

 

2, Pseudo cluster mode
The pseudo cluster mode is to start multiple zookeeper clusters on the same host and form a cluster. Next, create three zookeeper group clusters on one host as an example. Copy the single node zookeeper into three copies.

 

2.1 zookeeper 1 configuration
The configuration file of zookeeper 1 is modified as follows: D:\zkcluster\apache-zookeeper-3.5.7-bin-01\bin\zoo.cfg

# The number of milliseconds of each tick
tickTime=6000
# 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.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=D:\\zkcluster\\apache-zookeeper-3.5.7-bin-01\\data
dataLogDir=D:\\zkcluster\\apache-zookeeper-3.5.7-bin-01\\log
# the port at which the clients will connect
clientPort=5181
server.1=localhost:2888:3888
server.2=localhost:4888:5888
server.3=localhost:6888:7888
# 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

Create a myid file in each corresponding / data directory, and fill in the corresponding number.

 

 

Start zookeeper. The starting sequence is optional.

 

Published 66 original articles, won praise 11, visited 60000+
Private letter follow

Tags: Zookeeper Apache snapshot Hadoop

Posted on Sat, 07 Mar 2020 23:09:37 -0500 by Anti-Moronic