Zookeeper cluster construction under Linux

Source: Internet
Author: User
Tags zookeeper zookeeper client

First install VMware, installed two virtual machines, the version is Centos6.5,ip, respectively, is

192.168.3.20

192.168.3.21

Then download the Zookeeper package: http://zookeeper.apache.org/, use the command TAR-ZXVF zookeeper.tar.gz to extract the extract to the/opt/soft directory

Modify the hostname vim/etc/hosts to add two entries in the Hosts file

192.168.1.20 Master

192.168.1.21 slave1

Enter zookeeper directory, create folder data, enter data, create file myid,20 and 21 myID write 1 and 2 respectively

Enter the Conf directory, there is a profile template, copy one, name Zoo.cfg, modify Zoo.cfg, the content is as follows

Datadir=/opt/soft/zookeeper-3.4.5/data (The Data directory you just created)

clientport=2181

initlimit=10

Synclimit=5

ticktime=2000

server.1=master:2888:3888 (Zookeeper will find IP based on host name)

server.2=slave1:2888:3888

Shut down the firewall (if the firewall is not turned off, after the boot, will always error);

Execute command: bin/zkserver.sh start conf/zoo.cfg, respectively zookeeper

Then: tail-300f zookeeper.out View the contents of the output, if no error, indicating the success of the start;

Next look at the cluster is the success of the build:

Execution: Bin/zkcli.sh-server master:2181 (Master and slave1, choose one)

Go to the Zookeeper Client command line below, execute LS/, will output [zookeeper], this time create a node create/test, and then view get/test, print the information

TestValue
Czxid = 0x200000005
CTime = Fri Mar 15:07:23 PST 2017
Mzxid = 0x200000005
Mtime = Fri Mar 15:07:23 PST 2017
Pzxid = 0x200000005
cversion = 0
dataversion = 0
aclversion = 0
Ephemeralowner = 0x0
Datalength = 9
Numchildren = 0

Then switch to another IP, perform execution: Bin/zkcli.sh-server master:2181, then LS/view, you can see the node that was just created on another machine test

Above all through, explain zookeeper cluster build success!

Zookeeper cluster construction under Linux

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.