Zookeeper Pseudo-Cluster

Source: Internet
Author: User
Deploy three Services

Zoo-node1.cfg

# The number of milliseconds of each tick ticktime=2000 # The number of ticks, the initial # synchronization phase CA N Take initlimit=10 # The number of ticks so can pass between # Sending a request and getting an acknowledgement syncli
Mit=5 # The directory where the snapshot is stored.
# do not use/tmp for storage,/tmp here is just # example sakes. Datadir=g:/zookeeper-3.4.9/data/node1 Datalogdir=g:/zookeeper-3.4.9/logs/node1 # The port at which the clients would
Connect clientport=2181 # The maximum number of client connections. 
# Increase this if you need to handle more clients #maxClientCnxns =60 # # is sure to read the maintenance section of the
# Administrator Guide before turning on Autopurge. # # # # # # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # of snapshots to retain in da Tadir #autopurge. snapretaincount=3 # Purge Task interval in hours # Set to ' 0 ' to disable Auto Purge feature #autopurge. Pu Rgeinterval=1 # cluster configuration server.1=127.0.0.1:2287:3387 server.2=127.0.0.1:2288:3388 server.3=127.0.0.1:2289:3389 

Zoo-node2.cfg

# The number of milliseconds of each tick ticktime=2000 # The number of ticks, the initial # synchronization phase CA N Take initlimit=10 # The number of ticks so can pass between # Sending a request and getting an acknowledgement syncli
Mit=5 # The directory where the snapshot is stored.
# do not use/tmp for storage,/tmp here is just # example sakes. Datadir=g:/zookeeper-3.4.9/data/node2 Datalogdir=g:/zookeeper-3.4.9/logs/node2 # The port at which the clients would
Connect clientport=2182 # The maximum number of client connections. 
# Increase this if you need to handle more clients #maxClientCnxns =60 # # is sure to read the maintenance section of the
# Administrator Guide before turning on Autopurge. # # # # # # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # of snapshots to retain in da Tadir #autopurge. snapretaincount=3 # Purge Task interval in hours # Set to ' 0 ' to disable Auto Purge feature #autopurge. Pu Rgeinterval=1 # cluster configuration server.1=127.0.0.1:2287:3387 server.2=127.0.0.1:2288:3388 server.3=127.0.0.1:2289:3389 

Zoo-node3.cfg

# The number of milliseconds of each tick ticktime=2000 # The number of ticks, the initial # synchronization phase CA N Take initlimit=10 # The number of ticks so can pass between # Sending a request and getting an acknowledgement syncli
Mit=5 # The directory where the snapshot is stored.
# do not use/tmp for storage,/tmp here is just # example sakes. Datadir=g:/zookeeper-3.4.9/data/node3 Datalogdir=g:/zookeeper-3.4.9/logs/node3 # The port at which the clients would
Connect clientport=2183 # The maximum number of client connections. 
# Increase this if you need to handle more clients #maxClientCnxns =60 # # is sure to read the maintenance section of the
# Administrator Guide before turning on Autopurge. # # # # # # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # of snapshots to retain in da Tadir #autopurge. snapretaincount=3 # Purge Task interval in hours # Set to ' 0 ' to disable Auto Purge feature #autopurge. Pu Rgeinterval=1 # cluster configuration server.1=127.0.0.1:2287:3387 server.2=127.0.0.1:2288:3388 server.3=127.0.0.1:2289:3389 

Each configuration of the data under the creation of a mypid file, the corresponding Node1 content is 1,node2 is 2, the name corresponds to the cluster configuration of the service. X of X.
Start

Start-cluster.bat

@echo off
echo start

echo ================start-node1============= start "" "
g:/zookeeper-cluster/ Zookeeper1/bin/zkserver.cmd "

echo ================start-node2============= Start" ""
G:/zookeeper-cluster /zookeeper2/bin/zkserver.cmd "

echo ================start-node3============= Start" ""
g:/ Zookeeper-cluster/zookeeper3/bin/zkserver.cmd "
Start will error
Connection Broken for ID 1, my id = 2, error =java.net.socketexception:socket closed

This is because when you start a node with a mypid of 1, 2 is not connected, so it will report an not connected error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.