Zookeeper distributed architecture of the installation and testing of Cluster Setup instructions zookeeper

1. Zookeeper installation

Test JDK 1.1

Here Insert Picture Description

1.2 Upload Package

zookeeper's official website: https: //zookeeper.apache.org/releases.html

Here Insert Picture Description

1.3-extracting archive

tar -xvf zookeeper-3.4.14.tar.gz

1.4 delete archive, extract the files renamed zookeeper (custom)

Here Insert Picture Description

1.5 Creating data and log files

Here Insert Picture Description

1.6 zoo.cfg modify configuration files

1.6.1 into the data file pwd, copy its path

Here Insert Picture Description

1.6.2 Changing zoo_sample.cfg file named zoo.cfg

Here Insert Picture Description

1.6.3 modify dataDir path, which is just a data path (dataLogDir similar)

Here Insert Picture Description

1.7 is installed successfully detect Zooleeper

1.7.1 file into the bin directory, through sh zkServer.sh start open

Here Insert Picture Description

1.7.2 opening, through  sh zkServer.sh status detection state,

Here Insert Picture Description

Status is displayed as standalone Description On success, your success install Zookeeper! ! !

2.Zookeeper Cluster Setup

2.1 Preparations

2.1.1 Creating zkCluster file again zookeeper's root directory, which then create zk1 / zk2 / zk3 three folders
2.1.2 Creating data and log files in three folders - mkdir {zk1,zk2,zk3}  shentuylzc.cn  {data,log}

Here Insert Picture Description

2.2 Creating myid

2.2.1 Different document have different myidmyid -----www.yixingylzc.cn zk1 content of 1, zk2 is 2, zk3 3

Here Insert Picture Description

2.3 edit the configuration file

2.3.1 copy the path of zk1

Here Insert Picture Description

2.3.2 After modifying the configuration file is copied to zoo_www.shentuylgw.cn sample.cfg zoo1.cfg in the conf directory.
2.3.3 vim zoo1.cfg - >> change the configuration
  • DataLogDir dataDir path and data path and to use the corresponding log
  • The last digit of 2181 clientPort corresponding, simply follow myid numbers in the configuration, without modifying the remaining three
  • server.1 / 2/3 is superimposed on a part of the way, easy to remember
  • zoo2.cfg / zoo3.cfg just as I described above can change
  • Remember server.1 / 2/3 does not need to change the configuration only once

Here Insert Picture Description

2.4 Test Cluster Setup successful

sh zkServer.sh start   www.lexuancaizc.cn zoo1.cfg     开启
sh zkServer.sh stop    www.baishiyl2zc.cn zoo1.cfg     关闭
sh zkServer.sh status  www.motianydl.cn    zoo1.cfg     检测状态
2.4.1 In the figure I only opened the zoo1.cfg / zoo2.cfg ---- >> live from my box can be seen, zoo2.cfg for the host, zoo1.cfg from the machine, if zoo3.cfg open , still zoo2.cfg slave

Here Insert Picture Description

Zookeeper cluster build success! ! !

Guess you like

Origin www.cnblogs.com/laobeipai/p/12573610.html