Summary of common commands for building ZooKeeper3.4 middleware under centos7

Summary of common commands for building ZooKeeper3.4 middleware under centos7

1. Download and decompress

1. Introduction to Zookeeper

As a distributed service framework, Zookeeper is mainly used to solve the consistency problem of application systems in distributed clusters. It can provide data storage based on a directory node tree similar to the file system. However, Zookeeper is not used to store data specifically. Its main function is to maintain and monitor the status changes of the data you store. By monitoring the changes in these data states, data-based cluster management can be achieved.

2. Download

Environment Version

centos7
zookeeper 3.4.14

[root@localhost mysoft]$ cd /usr/local/mysoft/
[root@localhost mysoft]$
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
[root@localhost mysoft]# tar -zxvf zookeeper-3.4.14.tar.gz
[root@localhost mysoft]# mv zookeeper-3.4.14 zookeeper3.4

2. Modify the configuration file

1. Data and log directories

[root@localhost /]# mkdir -p data/log/zkp1.log
[root@localhost /]# mkdir -p data/zkpdata/zkp1

2. Modify the configuration

[root@localhost mysoft]# cd zookeeper3.4/conf/
[root@localhost conf]# cp zoo_sample.cfg zoo.cfg
[root@localhost conf]# vim zoo.cfg
# Modify the following two contents, the other default dataDir=/data/zkpdata/zkp1
dataLogDir=/data/log/zkp1.log

3. Configuration file description

1) tickTime
The time of the heartbeat check.
2) initLimit
The maximum number of heartbeats (number of tickTimes) that can be tolerated during the initial connection between the slave servers in the cluster and the master server.
3) syncLimit
The maximum number of heartbeats that can be tolerated between requests and responses from the slave server and the master server in the cluster.
4) dataDir
Data storage directory.
5) dataLogDir
Log storage directory.
6) clientPort
The client connection interface, the port that the client connects to the zookeeper server. The server will listen to this port, the default is 2181.

3. Start operation

1. Start the server [root@localhost bin]# pwd
/usr/local/mysoft/zookeeper3.4/bin
[root@localhost bin]# /usr/local/mysoft/zookeeper3.4/bin/zkServer.sh start /usr/local/mysoft/zookeeper3.4/conf/zoo.cfg

ZooKeeper JMX enabled by default
Using config: /usr/local/mysoft/zookeeper3.4/conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost bin]# ps -aux |grep zookeeper
2. Start the client [root@localhost /]# cd /usr/local/mysoft/zookeeper3.4/bin/
[root@localhost bin]# ./zkCli.sh 
Connecting to localhost:2181

4. Common operation commands

## Create a node [zk: localhost:2181(CONNECTED) 2] create /cicada cicada-smile1
Created /cicada
[zk: localhost:2181(CONNECTED) 8] create /cicada2 cicada-smile2
Created /cicada2
[zk: localhost:2181(CONNECTED) 4] get /cicada
cicada-smile1
## View the directory [zk: localhost:2181(CONNECTED) 5] ls /
[zookeeper, cicada, cicada2] 
## View the specified directory [zk: localhost:2181(CONNECTED) 17] ls / zookeeper
[com.ptp.user.service.UserService]
## Delete node [zk: localhost:2181(CONNECTED) 10] delete /cicada
## Delete all directories [zk: localhost:2181(CONNECTED) 18] rmr /cicada2
[zk: localhost:2181(CONNECTED) 19] ls /cicada2
Node does not exist: /cicada2
## View the remaining nodes [zk: localhost:2181(CONNECTED) 13] ls /
[zookeeper]

5. Source code address

GitHub address: Zhiyixiao
https://github.com/cicadasmile
Code Cloud Address: Zhilixiao
https://gitee.com/cicadasmile

Summarize

The above is a summary of the common commands for building ZooKeeper3.4 middleware under centos7 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time!

You may also be interested in:
  • Detailed explanation of the use based on Zookeeper
  • Shell script to automatically install zookeeper
  • Understanding the Zookeeper election mechanism
  • Configure the corresponding acl permissions for Zookeeper
  • A brief analysis of the working principle of ZooKeeper
  • Implementation of Docker to build Zookeeper&Kafka cluster
  • CentOS 6 uses Docker to deploy redis master-slave database operation example
  • Analysis of centos6 method of deploying kafka project using docker
  • Tutorial on deploying the open source project Tcloud with Docker on CentOS8
  • CentOS 6 uses Docker to deploy Zookeeper operation example

<<:  MySQL 5.7.17 compressed package installation-free configuration process diagram

>>:  MySQL 8.0.11 Community Green Edition Installation Steps Diagram for Windows

Blog    

Recommend

Why should the number of rows in a single MySQL table not exceed 5 million?

Today, let’s discuss an interesting topic: How mu...

Vue implements simple calculator function

This article example shares the specific code of ...

Improving the effect of hyperlinks in web design and production

Hyperlinks enable people to jump instantly from pa...

MySQL not null constraint case explanation

Table of contents Set a not null constraint when ...

HTML solves the problem of invalid table width setting

If you set the table-layer:fixed style for a tabl...

The difference between the four file extensions .html, .htm, .shtml and .shtm

Many friends who have just started to make web pag...

Mysql table creation foreign key error solution

Database Table A: CREATE TABLE task_desc_tab ( id...

JavaScript implements the detailed process of stack structure

Table of contents 1. Understanding the stack stru...

Implementation of react loop data (list)

First, let's simulate the data coming from th...

Using puppeteer to implement webpage screenshot function on linux (centos)

You may encounter the following problems when ins...

A brief analysis of MySQL backup and recovery

Table of contents 1. Introduction 2. Simple defin...

How to view the storage location of MySQL data files

We may have a question: After we install MySQL lo...

How to install ROS Noetic in Ubuntu 20.04

Disclaimer: Since the project requires the use of...

Practice of implementing custom search bar and clearing search events in avue

Table of contents 1. Customize the search bar con...