Constructing zookeeper pseudo-cluster under WIN10 environment

Source: Internet
Author: User
Tags zookeeper

First, download zookeeper

https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/

Here the author downloads is zookeeper-3.3.6

Second, configure the Zookeeper1. Extract to three directories we want to build 3 server pseudo-clusters on a single machine, we need to extract the downloaded zookeeper compressed package to three directories. The author's catalogue is as follows: server1:f:\paths\zookeeper\server1\zookeeper-3.3.6server2:f:\paths\zookeeper\server2\ zookeeper-3.3.6server3:f:\paths\zookeeper\server3\zookeeper-3.3.62. Creating a configuration file (cfg file)

After decompression, enter the Conf directory respectively, you can see the zoo_sample.cfg,log4j.properties and configuration.xsl three files.

Create a zoo.cfg file under this directory (you can also use Zoo_sample.cfg directly), configured as follows:

[HTML]View PlainCopy
  1. <span style="FONT-SIZE:14PX;" ># The number of milliseconds of each tick
  2. Ticktime=(2000ms, heartbeat interval, also zookeeper time unit)
  3. # The number of ticks that the initial synchronization phase can take
  4. initlimit=(10*ticktime = 20s, defines the time limit for initialization)
  5. # The number of ticks that can pass between sending a request and getting an acknowledgement
  6. synclimit=5 (5*ticktime = 10s, defining the time limit for synchronization)
  7. # The directory where the snapshot is stored.
  8. Datadir=F:\paths\zookeeper\server1\zookeeper-3.3.6\data (the storage directory for custom data snapshots, the data directory needs to be created by itself)
  9. datalogdir=F:\paths\zookeeper\server1\zookeeper-3.3.6\log (custom log storage directory, log directory needs to be created by itself)
  10. # The port at which the clients would connect
  11. clientport=2181 (Zookeeper service port)
  12. server.1=localhost:2887:3887 (Server1 identity of pseudo-cluster zookeeper)
  13. server.2=localhost:2888:3888 (Server2 identity of Pseudo-cluster zookeeper)
  14. server.3=localhost:2889:3889 (Server3 identity of Pseudo-cluster zookeeper)</span>

The above is the Server1 configuration file in zookeeper pseudo-cluster. Similarly, create Server2 and Server3 configuration file zoo.cfg in the Conf directory of the other two decompression paths. The parameters differ only in DataDir, Datalogdir, and ClientPort

Server2 's Zoo.cfg

[HTML]View PlainCopy
  1. <span style="FONT-SIZE:14PX;" ># The number of milliseconds of each tick
  2. Ticktime=
  3. # The number of ticks that the initial synchronization phase can take
  4. initlimit=Ten
  5. # The number of ticks that can pass between sending a request and getting an acknowledgement
  6. synclimit=5
  7. # The directory where the snapshot is stored.
  8. datadir=F:\paths\zookeeper\server2\zookeeper-3.3.6\data
  9. datalogdir=F:\paths\zookeeper\server2\zookeeper-3.3.6\log
  10. # The port at which the clients would connect
  11. clientport=2182
  12. server.1=localhost:2887:3887
  13. server.2=localhost:2888:3888
  14. server.3=localhost:2889:3889</span>

Server3 's Zoo.cfg

[HTML]View PlainCopy
  1. <span style="FONT-SIZE:14PX;" ># The number of milliseconds of each tick
  2. Ticktime=
  3. # The number of ticks that the initial synchronization phase can take
  4. initlimit=Ten
  5. # The number of ticks that can pass between sending a request and getting an acknowledgement
  6. synclimit=5
  7. # The directory where the snapshot is stored.
  8. datadir=F:\paths\zookeeper\server3\zookeeper-3.3.6\data
  9. datalogdir=F:\paths\zookeeper\server3\zookeeper-3.3.6\log
  10. # The port at which the clients would connect
  11. clientport=2183
  12. server.1=localhost:2887:3887
  13. server.2=localhost:2888:3888
  14. server.3=localhost:2889:3889</span>
3. Create a myID file

In the previous step, we specified the snapshot directory in DataDir, switch to each directory, create a file named myID (no suffix). The file content is an integer number.

The myID file in the Server1 data directory, with the content of 1.

The myID file in the Server2 data directory, with the content of 2.

The myID file in the Server3 data directory, with the content of 3.

Third, start zookeeper

respectively, switch to the bin directory under the three decompression path, the cmd input zkserver.cmd start service, you can use three cmd windows to start three server respectively, the author's boot sequence is server1-Server2-Server3. During startup, the error message is as follows:

This is zookeeper's leader election algorithm exception information, when the node does not start to complete, leader can not work properly, this error message is negligible, and other nodes after the start of normal.

Iv. Verify that the Zookeeper service starts entering JPS in CMD and can view the corresponding Java process.

Build zookeeper pseudo-cluster under WIN10 environment

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.