Zookeeper Windows pseudo-cluster setup

Source: Internet
Author: User
Tags zookeeper

1. Download Zookeeper http://mirror.bit.edu.cn/apache/zookeeper/

After decompression, the directory renamed to Zookeeper1, into the Conf directory, the ZOO_SAMPLE.CFG copy, renamed to Zoo.cfg

Edit Zoo_simple.cfg

Configuration Data directory and log directory:

First, in the Zookeeper1 directory, create a new directory data, logs

#------------Log directory------------#dataDir=/tmp/zookeeperdatadir=d:/develop-env/zookeeper/ Zookeeper1/data

#日志目录
Datalogdir=d:/develop-env/zookeeper/zookeeper1/logs

Set the port number

#------------Port------------clientport=2181

Configuring the Cluster Server

#------------Cluster Server------------#server. id=host:port1:port2 The following 2 ports represent follow server ports, leader server ports, respectively

server.1=127.0.0.1:1100:1200
server.2=127.0.0.1:2100:2200
server.3=127.0.0.1:3100:3200

Set the server ID

Under zookeeper1/data/directory, create a new myID file, insert the value 1 (server ID)

Copy zookeeper1 multiple copies, for pseudo-Cluster service, and name Zookeeper2, Zookeeper3 ...

The/conf/zoo.cfg for modifying Zookeeper2 and Zookeeper3 were:

 #------------log directory------------#dataDir  =/ Tmp/zookeeperdatadir  =d:/develop-env/zookeeper/ zookeeper2   /data# Log Location Datalogdir  =d:/develop-env/zookeeper/ zookeeper2   /logs#------------Port------------clientport  =  2182   Span style= "COLOR: #000000" >#------------clustered Server------------#server. ID  =host:  Port1:port2 the following 2 ports represent the follow server port, leader Server port server . 1=127.0.0.1:1100:1200 Server . 2=127.0.0.1:2100:2200 server . 3=127.0.0.1:3100:3200 
#------------Log directory------------#dataDir=/tmp/zookeeperdatadir=d:/develop-env/zookeeper/ zookeeper3/data# log location Datalogdir=d:/develop-env/zookeeper/zookeeper3/logs#----------- -Port------------ClientPort=2183#------------Cluster Server------------#server. ID=host: Port1:port2 the following 2 ports represent the follow server port, leader Server port server. 1=127.0.0.1:1100:1200  server. 2= 127.0.0.1:2100:2200  server. 3=127.0.0.1:3100:3200

and modify the file Zookeeper2/data/myid and Zookeeper3/data/myid, respectively, modify the data to 2, 3

Start a pseudo-cluster zookeeper

Go to cmd, switch directory to/zookeeper1/bin/, execute command zkserver.cmd (the error log will be printed at this time, do not worry, this is the heartbeat check connection other ZK services, such as the start of more than half of the group of ZK Services, no error)

Go to cmd, switch directory to/zookeeper2/bin/, execute command zkserver.cmd

Go to cmd, switch directory to/zookeeper3/bin/, execute command zkserver.cmd

Since then, the Windows pseudo-Cluster service has been built

Whether the test was successful

CMD, switch directory to/zookeeper1/bin, execute command zkcli.cmd-server localhost:2181

Wait for the brush screen finished, appears as follows zk:localhost:2181<connected> 0:, indicating the success of the service connection, also shows the establishment of the ZK service success.

Zookeeper Windows pseudo-cluster setup

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.