Installing zookeeper under CentOS

Source: Internet
Author: User
Tags zookeeper

1. Requirements

Installing Zookeeper,metaq

2. Download

Http://zookeeper.apache.org/releases.html

The current version of stable is Zookeeper-3.5.1-alpha

3. Unzip

TAR–XF zookeeper-3.5.1-alpha.tar.gz

Unzip the file to "/root/softwares/zookeeper-3.5.1-alpha".

4. Copy the zoo_sample.cfg in the Conf directory and name it zoo.cfg

5. Modify the Zoo.cfg configuration file

# The number of milliseconds of each tick
ticktime=2000
# The number of ticks that initial
# Synchronization phase can take
initlimit=10
# The number of ticks that can pass between
# Sending a request and getting an acknowledgement
Synclimit=5
# The directory where the snapshot is stored.
# do not use/tmp for storage,/tmp here are just
# example Sakes.
Datadir=/datatmp/zookeeper/data
Datalogdir=/datatmp/zookeeper/logs
# The port at which the clients would connect
clientport=2181
# The maximum number of the client connections.
# Increase this if you need to handle more clients
#maxClientCnxns =60
#
# Be sure to read the maintenance section of the
# Administrator Guide before turning on Autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in DataDir
#autopurge. snapretaincount=3
# Purge task interval in hours
# Set to ' 0 ' to disable Auto Purge feature
#autopurge. purgeinterval=1
#2888, 3888 is election port
server.1=zookeeper:2888:38888

Where the 2888 port number is the port of communication between services, and 3888 is the zookeeper port that communicates with other applications. The zookeeper is the IP that has been mapped to the native in the hosts.

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 5*2000=10 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 2*2000=4 seconds.
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.

6. Create the directory specified by the DataDir parameter (this refers to "/datatmp/zookeeper/data") and create a file under the directory named "myID".

7. Edit the "myID" file and enter the corresponding number on the corresponding IP machine. As on zookeeper, the "myID" file content is 1. Because this time only installs the configuration on the single point, therefore only one server.1. If there are other servers, such as the address 192.168.1.102, you will also need to add server.2=192.168.1.102:2888:3888 to the Zoo.cfg file. Then the content of the myID file on the 192.168.1.102 server is 2. At this point, if it is a multi-server configuration, you need to copy the zookeeper-3.4.3 directory to a different server, and then modify the myID as described above.

8. Set path in the/etc/profile file
To modify a profile:
sudo vi/etc/profile

Export Zookeeper_home=/root/softwares/zookeeper/zookeeper-3.5.1-alphaexport path= $ZOOKEEPER _home/bin: $PATHexport PATH

OH YEAH!!! Installation is complete!

It's all set up, start screwing up.

1. Start

zookeeper-3.5.1-alpha/bin/zkserver.sh start

2. Enter the JPS command to view the process

1573 QuorumPeerMain1654 Jps

Among them, Quorumpeermain is the zookeeper process, starting normal.

3. Viewing Status: Zookeeper-3.5.1-alpha/bin/zkserver.sh status

-JMX enabled by defaultusing Config:/usr/local/zookeeper-3.4.6/bin/. /conf/zoo.cfgmode:standalone

4. Start client script: Zookeeper-3.5.1-alpha/bin/zkcli.sh-server zookeeper:2181

5. Stop Zookeeper process: zookeeper-3.5.1-alpha/bin/zkserver.sh stop

Participation:

Http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html

Installing zookeeper under CentOS

Related Article

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.