Zookeeper Windows Cluster Construction

The configuration of zoo in the D: zookeeper-3.4.14 conf directory in the zookeeper-3.4.14 file is as follows

# 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.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=D:\\zookeeper-3.4.14\\data
# the port at which the clients will connect
clientPort=2181
# 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
server.1=127.0.0.1:2887:3881
server.2=127.0.0.1:2888:3882
server.3=127.0.0.1:2889:3883

Note here that dataDir = D:\zookeeper-3.4.14\\data uses backslashes

Create a new data folder under the directory D: zookeeper-3.4.14, then cmd under the file and enter the command echo 1 > myid to create a myid file with content 1.

Note that if you report an error in java.lang.Illegal ArgumentException: serverid 1 is not a number, open the new myid file, press the delete key and you will find a space behind 1, remove the space and save it.

Under the zookeeper2 file, the configuration of the zoo file in the following directory

# 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.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=D:\\zookeeper2\\data
# the port at which the clients will connect
clientPort=2182
# 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
server.1=127.0.0.1:2887:3881
server.2=127.0.0.1:2888:3882
server.3=127.0.0.1:2889:3883

Similarly, notice that dataDir = D:\zookeeper2\\data is backslash, the same new data folder is created in the D:\zookeeper2 directory, the same myid file is created in the cmd under the D:\zookeeper2\data directory, and the same is true if you report java.lang.Illegal ArgumentException: serverid 2 is not a number, the same new file is opened. If you press the delete key, you will find a space behind 2. Remove the space and save it.

Under zookeeper3 file, the configuration of zoo file is as follows

# 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.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=D:\\zookeeper3\\data
# the port at which the clients will connect
clientPort=2183
# 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
server.1=127.0.0.1:2887:3881
server.2=127.0.0.1:2888:3882
server.3=127.0.0.1:2889:3883

The location of the zoo file is as follows

Similarly, notice that dataDir = D:\zookeeper3\\\data is backslash. Similarly, create a new data folder in the D:\zookeeper3 directory. Similarly, create a myid file in the D:\zookeeper3\data directory. Similarly, if you report java.lang.Illegal ArgumentException: serverid 3 is not a number, open the new file. If you press the delete key, you will find a space behind 3. Remove the space and save it.

start-up

start-up

start-up

When the three zookeeper s appealed are started, they will heartbeat each other and find the other group as a cluster. So if these three services are not started, they should not be taken care of until all services are started. After all three services have been started, the results are shown below in turn.

Keywords: Zookeeper snapshot Apache Java

Added by hey_suburbia on Thu, 05 Sep 2019 08:40:28 +0300