Deploying Zookeeper Clusters

Source: Internet
Author: User

This article is for the big data development environment to write, configuration is relatively simple. Zookeeper Introduction, working principle, characteristics of self-access to a certain degree of Wikipedia, said very clearly. Again, it is necessary to emphasize that the number of machine nodes in the Zookeeper cluster is 2n-1 (odd).


Preparatory work:

Download zookeeper-3.4.6.tar.gz

Http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz


Virtual Machine Environment: (The configuration used in this article)

IP address hostname

192.168.32.130 slave1

192.168.32.131 Slave2

192.168.32.132 Slave3


Operating System Image: Centos-6.7-i386-bin-dvd1.iso


SSH Tools: SecureCRT 7.3.1


/************************************** Split Line ****************************************/


First step: Prepare the operating system environment:

The operation of this article is based on the "hadoop2.6.0 Cluster Build" blog post, operating system environment and the Hadoop deployment environment, if not configured, it is recommended to follow the first step in "hadoop2.6.0 cluster Build" and configure the host name.


Step Two: Deploy Zookeeper

1. Upload the zookeeper to the slave1 virtual machine.


2. Unzip and install the Zookeeper package (go to the directory where zookeeper-3.4.6.tar.gz is located and unzip to the specified directory using the tar command)

[Email protected] ~]# tar zxvf zookeeper-3.4.6.tar.gz-c/usr/local


3. The zookeeper-3.4.6 file will be generated in the/usr/local directory after decompression


4. Configure the Zookeeper directory to global environment variables, such as:

[Email protected] ~]# vim/etc/profile #在末尾添加如下内容 #zookeeperexport zookeeper_home=/usr/local/zookeeper-3.4.6export Path= $ZOOKEEPER _home/bin: $PATH


5, create the Zookeeper data and log directory (where to create the line this article is created in the/var directory)

[[email protected] ~]# cd/var[[email protected] var]# mkdir-p zookeeper/data[[email protected] var]# mkdir Zookeeper/log [[email protected] var]# chmod 755 zookeeper/data[[email protected] var]# chmod 755 zookeeper/log

6. Modify the Zookeeper configuration file


Because the Zookeeper startup script defaults to using the zoo.cfg name of the configuration file, Zoo_sample.cfg is copied to Zoo.cfg

[[email protected] ~]# Cd/usr/local/zookeeper-3.4.6/conf[[email protected] conf]# CP zoo_sample.cfg Zoo.cfg[[email Protected] conf]# vim zoo.cfg

Add content as follows

Datadir=/var/zookeeper/data #第5步创建的目录dataLogDir =/var/zookeeper/log #第5步创建的目录server. 1=slave1:2888:3888 # The domain name (hostname) needs to be set according to its actual situation server.2=slave2:2888:3888 server.3=slave3:2888:3888


7. Create the myID file in the data directory and add the content

[[Email protected] ~] #cd/var/zookeeper/data[[email protected] data] #vi myID

Add Content:

1


8. Upload zookeeper to other machines

[[Email protected] ~] #scp –r/usr/local/zookeeper-3.4.6 [email protected]:/usr/local[[email protected] ~] #scp –r/usr/ local/zookeeper-3.4.6 [Email protected]:/usr/local


9. Create Zookeeper/data and Zookeeper/log in the/var directory on slave2 and slave3 machines and give 755 permissions (same as 5th step)


10. Create and add myID (same as 7th step)

Slave2 Machine Add

2

Slave3 Machine Add

3

11. Start zookeeper on each machine

zkserver.sh start

/******************************* Gorgeous split-line ************************************/

At this point, the Zookeeper cluster deployment is complete and can be tested using the following methods:

Perform operational testing on any node machine using the Zookeeper zkcli.sh client script link zookeeper the Cluster service

[[Email protected] ~] #zkCli. Sh-server slave1:2181create/project Zookeeper_projectget/project


View this record on a different node


Big Data Technology QQ Group: 576216694

Sweep code into the group:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/89/46/wKiom1gOFJ-BKaJ-AAAhKcHDxCA947.png "title=" Wkiom1ghg4gap74taaahj9szjee163.png "alt=" Wkiom1gofj-bkaj-aaahkchdxca947.png "/>

This article is from the "12175535" blog, please be sure to keep this source http://12185535.blog.51cto.com/12175535/1865203

Deploying Zookeeper Clusters

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.