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: