Remember to build zookeeper clusters on multiple Linux servers

Source: Internet
Author: User
Tags zookeeper iptables

Set up a zookeeper cluster, use three Linux, build three nodes of the cluster, here to record.

on Linux you can use the wget+ url + version number, There is a space between the wget and the URL, You can Download the appropriate software version directly on the Linux network.

First, execute under the/usr/local

# wget http://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz

Unzip: # TAR-ZXVF zookeeper-3.4.5.tar.gz

Delete: # RM-RF zookeeper-3.4.5.tar.gz

View Catalog: # ll

Enter: # CD Zookeeper-3.4.5/conf

Copy the configuration file and view: # CP Zoo_sample.cfg zoo.cfg

To Modify a configuration file: # VI Zoo.cfg

and modify datadir to:datadir=/usr/local/zookeeper-3.4.5/data

At the end add:

server.0=eshop-cache01:2888:3888

server.1=eshop-cache02:2888:3888

server.2=eshop-cache03:2888:3888

here,Eshop-cache01 is one of my three Linux host names,2888 and 3888 and the 2181 is the port number of my three node, so three Linux to open this three port at the firewall, which will be operated later.

Save exit: Wq

go back to the zookeeper-3.4.5 level to create the data file:

go to Data folder:# CD Data

Create myID file:# VI myID

Enter a 0, and then save the exit.

This is the construction of three nodes, so the other two myID files are filled for each .

It 's basically going to start up here, but first open the port and execute: # Vi/etc/sysconfig/iptables

Then add:

-A input-p tcp-m state--state new-m TCP--dport 2181-j ACCEPT

-A input-p tcp-m state--state new-m TCP--dport 2888-j ACCEPT

-A input-p tcp-m state--state new-m TCP--dport 3888-j ACCEPT

Save exit, restart Service: # service Iptables Restart

View Port:# iptables-l-N

then go to the Zookeeper bin directory to start zookeeper, execute:#./zkserver.sh Start

then look at the process: # Ps-ef | grep zookeeper

in the bin directory, enter zookeeper.outto see if the boot is ok: # cat Zookeeper.out

No errors.

then look at the Zookeeper state, also in the bin directory:#./zkserver.sh Status

Other two units:

we can see that there are two follower and one leader, to which three Linux three nodes are set up. Zookeeper cluster is finished.

The other two units are similar, but the point to note is to modify the myid zookeeper.out , put the error zookeeper execute: #./zkserver.sh restart Well, just a reboot.

three Linux brackets if the use of ssh, directly to the first set of /usr/local/ under the zookeeper-3.4.5 Copy to the other two /usr/local directory, modify the myID it is possible.

different Linux replication can use this command:# scp-r zookeeper-3.4.5 [email protected]:/usr/local

Remember to build zookeeper clusters on multiple Linux servers

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.