Zookeeper Installation and configuration

Source: Internet
Author: User

(1) download zookeeper, the recommended choice of stable version, that is stable.

     [Email protected] ~]# cd/usr/local

[Email protected] local]# wget http://apache.dataguru.cn/zookeeper/stable/zookeeper-3.4.6.tar.gz

(2) Decompression

     [Email protected] local]# TAR-ZXVF zookeeper-3.4.6.tar.gz

(3) Modify the configuration file

     [Email protected] local]# cd/usr/local/zookeeper-3.4.6/conf/

[Email protected] conf]# MV Zoo.cfg.sample zoo.cfg

[Email protected] conf]# VI zoo.cfg

# Modify as follows

Datadir=/usr/local/zookeeper-3.4.6/data

# append the following three lines

server.1=10.211.55.21:2888:3888

server.2=10.211.55.22:2888:3888

server.3=10.211.55.23:2888:3888

        

File Related parameter description:

①ticktime: Heartbeat time, in milliseconds.

②initlimit: This configuration item is used to configure the Zookeeper accept client (the client here is not the client that connects the Zookeeper server, but the Leader that is connected to Follower in the Zookeeper server cluster) Server) The maximum number of heartbeat intervals that can be tolerated when a connection is initialized. The client connection failed when the Zookeeper server has not received the return information of the client after 10 heartbeats (that is, ticktime) length. The total length of time is 10*2000=20 seconds.

③synclimit: This configuration item identifies the length of time that a message, request and response is sent between Leader and Follower, the maximum number of ticktime, and the total length of time is 5*2000=10 seconds.

④datadir: Stores the location of the database snapshot in memory.

⑤clientport: Listening for client connected ports

⑥server. A=b:c:d: Where A is a number, indicating this is the first server, B is the IP address of this server, C is the server and the Leader server in the cluster to exchange information on the port; D means that in case the Leader server in the cluster hangs, a port is needed to re-elect , select a new Leader, which is the port that the server communicates with each other when the election is performed. If it is a pseudo-cluster configuration, because B is the same, so different Zookeeper instance communication port numbers can not be the same, so they should be assigned a different port number. The myID file is created under the DataDir directory, and the content is set to a value in the upper ⑥ to identify the different servers.

[Email protected] local]# Mkdir/usr/local/zookeeper-3.4.6/data

      [Email protected] local]# Touch/usr/local/zookeeper-3.4.6/data/myid

      [Email protected] local]# echo 1 >/usr/local/zookeeper-3.4.6/data/myid

(4) Copy the configuration of Bonnie1 to other nodes

[Email protected] local]# scp-r/usr/local/zookeeper-3.4.6/bonnie2:/usr/local

      [Email protected] local]# scp-r/usr/local/zookeeper-3.4.6/bonnie3:/usr/local

(5) Modify the ID number in the configuration file on the corresponding device

[Email protected] local]# echo 2 >/usr/local/zookeeper-3.4.6/data/myid (bonnie2)

[Email protected] local]# echo 3 >/usr/local/zookeeper-3.4.6/data/myid (bonnie3)

(6) Start zookeeper

# Zookeeper of the boot node bonnie1

[Email protected] ~]# cd/usr/local/zookeeper-3.4.6/bin/

[[email protected] bin]#./zkserver.sh start

JMX enabled by default

Using config:/usr/local/zookeeper-3.4.6/bin/. /conf/zoo.cfg

Starting zookeeper ... STARTED

# Zookeeper of the boot node bonnie2

[Email protected] ~]# cd/usr/local/zookeeper-3.4.6/bin/

[[email protected] bin]#./zkserver.sh start

# Zookeeper of the boot node bonnie3

[Email protected] ~]# cd/usr/local/zookeeper-3.4.6/bin/

[[email protected] bin]#./zkserver.sh start

# View the zookeeper status of each node

[Email protected] bin]#./zkserver.sh status

JMX enabled by default

Using config:/usr/local/zookeeper-3.4.6/bin/. /conf/zoo.cfg

Mode:follower

[Email protected] bin]# JPS

3191 Jps

3124 Quorumpeermain

[Email protected] bin]#./zkserver.sh status

JMX enabled by default

Using config:/usr/local/zookeeper-3.4.6/bin/. /conf/zoo.cfg

Mode:leader

[Email protected] bin]# JPS

3191 Jps

3124 Quorumpeermain

[Email protected] bin]#./zkserver.sh status

JMX enabled by default

Using config:/usr/local/zookeeper-3.4.6/bin/. /conf/zoo.cfg

Mode:follower

[Email protected] bin]# JPS

3191 Jps

3124 Quorumpeermain

Zookeeper Installation and configuration

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.