What are the common commands for building ZooKeeper3.4 middleware under centos7
This article will explain in detail what are the common commands for building ZooKeeper 3.4 middleware under centos7. Xiaobian thinks it is quite practical, so share it with you as a reference. I hope you can gain something after reading this article.
1. Download and decompress
1. Introduction to Zookeeper
Zookeeper as a distributed service framework, mainly used to solve the problem of consistency of application systems in distributed clusters, it can provide data storage based on directory node tree similar to file system, but Zookeeper is not used to store data, its role is mainly used to maintain and monitor the state changes of your stored data. Data-based cluster management can be achieved by monitoring changes in the state of these data.
2. Download
environment version
centos7zookeeper 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
II. 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 configuration
[root@localhost mysoft]# cd zookeeper 3.4/conf/[root@localhost conf]# cp zoo_sample.cfg zoo.cfg[root@localhost conf]# vim zoo.cfg#Modify the following two pieces of content, other default dataDir=/data/zkpdata/zkp1dataLogDir =/data/log/zkp1.log
3. Configuration file description
1)tickTime
Time of the heartbeat check.
2)initLimit
The maximum number of heartbeats (tickTime) that can be tolerated at initial connection between slave and master servers in the cluster.
3)syncLimit
The maximum number of heartbeats that can be tolerated between the slave and master servers in the cluster.
4)dataDir
Data repository directory.
5)dataLogDir
Log storage directory.
6)clientPort
The interface to which the client connects. The port to which the client connects to the zookeeper server. The server listens on this port. The default is 2181.
III. Start-up operation
1. Start server [root@localhost bin]# pwd/usr/local/mysoft/zookeeper 3.4/bin[root@localhost bin]# /usr/local/mysoft/zookeeper 3.4/bin/zkServer.sh start /usr/local/mysoft/zookeeper 3.4/conf/zoo.cfgZookeeper JMX enabled by defaultUsing config: /usr/local/mysoft/zookeeper 3.4/conf/zoo.cfgStarting zookeeper ... STARTED[root@localhost bin]# ps -aux |grep zookeeper2, Start client [root@localhost /]# cd /usr/local/mysoft/zookeeper 3.4/bin/[root@localhost bin]# ./ zkCli.sh Connecting to localhost:2181
IV. Common operating commands
##Create Node [zk: localhost:2181 (CONNECTED) 2] create /cicada cicada-smile1Created /cicada[zk: localhost:2181 (CONNECTED) 8] create /cicada2 cicada-smile2Created /cicada2[zk: localhost:2181 (CONNECTED) 4] get /cicadacicada-smile1##View directory [zk: localhost:2181 (CONNECTED) 5] ls /[zookeeper, cicada, cicada2] ##View specified directory [zk: localhost:2181 (CONNECTED) 17] ls / zookeeper[com.ptp.user.service.UserService]##Delete node [zk: localhost:2181 (CONNECTED) 10] delete /cicada##Delete directory all [zk: localhost:2181 (CONNECTED) 18] rmr /cicada2[zk: localhost:2181 (CONNECTED) 19] ls /cicada2Node does not exist: /cicada2##See the rest of the nodes [zk: localhost:2181(CONNECTED) 13] ls /[zookeeper] About "What are the common commands to build ZooKeeper 3.4 middleware under centos7" This article is shared here. I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, please share it for more people to see.