Windows installation and use Zookeeper

Source: Internet
Author: User

Zookeeper official website: http://zookeeper.apache.org/Now the latest version is 3.4.6, but this version I did not run, it may be the configuration problem, now I use 3.4.5 http:// apache.fayea.com/apache-mirror/zookeeper/zookeeper-3.4.5/

Environment: Windows 8.1, zookeeper3.4.5

Now to do is a single-machine pseudo-cluster (wood has a way not so many machines AH)

    1. Modify the configuration file in conf

      Copy the Zoo_sample.cfg file to a renamed Zoo.cfg

    2. Modify zoo.cfg content

Open zoo.cfg:

?
12345678910111213141516171819202122232425 # The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/tmp/zookeeper# the port at which the clients will connectclientPort=2181## 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

After modification:

?
12345678910111213141516171819202122232425262728293031 # The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=E:/zookeepercluster/servcer001/datadataLogDir=E:/zookeepercluster/servcer001/logs# the port at which the clients will connectclientPort=2181## 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=1server.1=localhost:8881:7771server.2=localhost:8882:7772#server.3=192.168.192.7:8883:7773#server.4=192.168.192.7:8884:7774#server.5=192.168.192.7:8885:7775

The main is to add a few servers below the IP address, because my all is the machine, so I this is the same address.

Parameter explanation:

    • Ticktime: Heartbeat interval, Unit: milliseconds

    • Datadir:zookeeper the directory where the data is stored.

    • ClientPort: The client connects to the port of the Zookeeper server, Zookeeper listens to the port and accepts the client's access request.

    • Initlimit: This configuration item is used to configure the Zookeeper accept client (the client here is not the client that connects the Zookeeper server, but the Leader that is connected to Follower in the Zookeeper server cluster) Server) The maximum number of heartbeat intervals that can be tolerated when a connection is initialized. The client connection failed when the Zookeeper server has not received the return information of the client after 5 heartbeats (that is, ticktime) length. The total length of time is 5*2000=10 seconds.

    • Synclimit: This configuration item identifies the length of time that a message, request and response is sent between Leader and Follower, the maximum number of ticktime, and the total length of time is 2*2000=4 seconds

    • Server. A=b:c:d: Where A is a number, indicating this is the first server, B is the IP address of this server, C is the server and the Leader server in the cluster to exchange information on the port; D means that in case the Leader server in the cluster hangs, a port is needed to re-elect , select a new Leader, which is the port that the server communicates with each other when the election is performed. If it is a pseudo-cluster configuration, because B is the same, so different Zookeeper instance communication port numbers can not be the same, so they should be assigned a different port number.

3. Create a myID file under data with the contents of 1

This content corresponds to this zookeeper order, the first zookeeper is 1, the second zookeeper is 2, there is no order, but can not be repeated.

It's best to match the X in server.x.

Modify profile resume Server02,server03,server04 node directory structure as follows:

├──server001

│├──data

│├──logs

│└──zookeeper-3.4.5

├──server002

│├──data

│├──logs

│└──zookeeper-3.4.5

├──server003

│├──data

│├──logs

│└──zookeeper-3.4.5

├──server004

│├──data

│├──logs

│└──zookeeper-3.4.5

└──server005

├──data

├──logs

└──zookeeper-3.4.5

This configures the single-machine pseudo-cluster under Windows.

Here is the boot:

Under the bin double-click: Zkserver.cmd

This error is reported because the node does not start up, all started will not report an error

Run zkserver.cmd status to see if the role of the node is leader or follower

Such a pseudo-cluster will succeed, if there is a wrong place want everyone to criticize, ORZ.

Reference article:

Http://www.cnblogs.com/haippy/archive/2012/07/19/2599989.html

http://zookeeper.apache.org/

Http://zookeeper.apache.org/doc/current/zookeeperStarted.html

Http://zookeeper.apache.org/doc/current/index.html

http://www.ibm.com/developerworks/cn/opensource/os-cn-zookeeper/

Windows installation and use Zookeeper

Related Article

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.