Introduction to Zookeeper (1) Implementation of zookeeper Pseudo-cluster/pseudo-clustered deployment on single machine

Source: Internet
Author: User
Tags zookeeper

The Zooker Introductory Tutorial series:

1-How to implement zookeeper pseudo cluster/pseudo clustered deployment on a single machine

2-Interpreting Zookeeper configuration items

-----This article is a basic tutorial for getting started, written for situations where you don't have the extra machines to try and try to deploy a fleet.

  

1. Download Decompression Zookeeper

(1) Download address: slightly

(2) Decompression: slightly

Note that you're going to build several zookeeper servers on your stand-alone machine, and you'll create a few directories and then unzip zookeeper in each directory.


2. A stand-alone pseudo-cluster with a scale of 3

(1) Server0

New Directory Data:/home/michael/opt/zookeeper/server0/zookeeper/data

New Directory Logs:/home/michael/opt/zookeeper/server0/zookeeper/logs

New File Myid:/home/michael/opt/zookeeper/server0/zookeeper/data/myid

The contents are as follows:

0


New File Zoo.cfg:/home/michael/opt/zookeeper/server0/zookeeper/conf/zoo.cfg

The contents are as follows:

ticktime=2000
initlimit=5
synclimit=2
datadir=/home/michael/opt/zookeeper/server0/zookeeper/data
datalogdir=/home/michael/opt/zookeeper/server0/zookeeper/logs
clientport=4180
server.0= 127.0.0.1:8880:7770
server.1=127.0.0.1:8881:7771
server.2=127.0.0.1:8882:7772


(2) Server1

New Directory Data:/home/michael/opt/zookeeper/server1/zookeeper/data

New Directory Logs:/home/michael/opt/zookeeper/server1/zookeeper/logs

New File Myid:/home/michael/opt/zookeeper/server1/zookeeper/data/myid

The contents are as follows:

1


New File Zoo.cfg:/home/michael/opt/zookeeper/server1/zookeeper/conf/zoo.cfg

The contents are as follows:

ticktime=2000
initlimit=5
synclimit=2
datadir=/home/michael/opt/zookeeper/server1/zookeeper/data
datalogdir=/home/michael/opt/zookeeper/server1/zookeeper/logs
clientport=4181
server.0= 127.0.0.1:8880:7770
server.1=127.0.0.1:8881:7771
server.2=127.0.0.1:8882:7772




(3) Server2

New Directory Data:/home/michael/opt/zookeeper/server2/zookeeper/data

New Directory Logs:/home/michael/opt/zookeeper/server2/zookeeper/logs

New File Myid:/home/michael/opt/zookeeper/server2/zookeeper/data/myid

The contents are as follows:

2


New File Zoo.cfg:/home/michael/opt/zookeeper/server2/zookeeper/conf/zoo.cfg

The contents are as follows:

ticktime=2000
initlimit=5
synclimit=2
datadir=/home/michael/opt/zookeeper/server2/zookeeper/data
datalogdir=/home/michael/opt/zookeeper/server2/zookeeper/logs
clientport=4182
server.0= 127.0.0.1:8880:7770
server.1=127.0.0.1:8881:7771
server.2=127.0.0.1:8882:7772




3. Start all servers of the zookeeper pseudo-cluster

Start the service by entering the/zookeeper/bin directory of three servers, respectively.

./zkserver.sh Start

4. Access client

Enter the Zookeeper/bin directory of any server, start a client, access the service.

./zkcli.sh–server 127.0.0.1:4181



Related commands, which can be viewed by entering help.

Help



My demo diagram on this computer looks like this:


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.