Zookeeper cluster construction of Linux

Source: Internet
Author: User
Tags zookeeper

Version: Zookeeper-3.5.4-beta.tar.gz + jdk-8u171-linux-x64.tar.gz

Cluster construction (3 nodes)

Multiple nodes repeat the same operation:

1. Upload the JDK and zookeeper installation packages to Linux

2. Decompression

You can delete the compressed package after decompression

3. Move the JDK installation package to/usr/local/java

Move the Zookeeper installation package to/usr/local

Rename the Zookeeper installation package to zookeeper

4. Configure the JDK environment variables and zookeeper environment variables (add at the end of the file)

Export java_home=/usr/local/java/jdk1.8.0_171
Export Zk_home=/usr/local/zookeeper
Export path= $PATH: $JAVA _home/bin: $ZK _home/bin

Change the file to take effect after modification

Note: This file is a global variable file, and if an error occurs, check that the input environment variable has spaces on the left and right sides of "="

5. Verify that the environment variable is configured correctly

Normal display of information proves successful JDK installation

6, modify the Zookeeper configuration file

Enter the location of the configuration file

Modify the zoo_sample.cfg name called Zoo.cfg

Modifying a configuration file

Datadir=/usr/local/zookeeper/data

clientport=2181

server.0=192.168.145.128:2888:3888
server.1=192.168.145.129:2888:3888
server.2=192.168.145.130:2888:3888

Server. X: The x here is a number that is consistent with the ID in the myID file. The right can be configured with two ports, the first port is used for data synchronization between F and L and other communication, and the second port is used for leader voting communication during the election process.

Datadir:zookeeper The data storage location, storing The directory of the snapshot file snapshot. By default, the transaction log is also stored here. It is recommended to configure the parameter datalogdir at the same time , the write performance of transaction log directly affects ZK performance

ClientPort: The port of the Client connection server, which is the external service port, is typically set to 2181 by default

7. Create New Data folder

8. New myID file in data for election

Note: Echo x here corresponds to x in Server.x in Zoo.cfg

9. See if myID is created correctly

Normal return x represents success

10. Start Zookeeper

Two ways to start:

1. Because the environment variable is already configured, you can enter it at any location

2. Go to the directory where the script is executed

Execute script

View Zookeeper boot status after successful execution

The boot succeeds and the installation succeeds.

Zookeeper cluster construction of Linux

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.