In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Source code of this article: GitHub click here | | GitEE click here |
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 directory node tree similar to file system, but Zookeeper is not used to store data specifically, its function is to maintain and monitor the state changes of your stored data. By monitoring the changes in the state of these data, data-based cluster management can be achieved.
2. Download the software
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 II, modify configuration file 1, Data and log directory [root@localhost /] # mkdir-pdata/ log/zkp1.log [root@localhost /] # mkdir-pdata/ zkpdata/zkp12, modify 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 pieces Other default dataDir=/data/zkpdata/zkp1dataLogDir=/data/log/zkp1.log3, profile description 1) time of tickTime heartbeat check. 2) the maximum number of heartbeats (number of tickTime) that can be tolerated during the initial connection between the slave server and the master server in the initLimit cluster. 3) the maximum number of heartbeats that can be tolerated between the slave server and the master server in syncLimit cluster. 4) dataDir data storage directory. 5) dataLogDir log storage directory. 6) the interface to which the clientPort client connects, and the port on which the client connects to the zookeeper server. The server will listen on this port. The default is 2181. 3. Start and run 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 defaultUsing config: / usr/local/mysoft/zookeeper3.4/conf/zoo.cfgStarting zookeeper. STARTED [root@localhost bin] # ps-aux | grep zookeeper2, launch client [root@localhost /] # cd / usr/local/mysoft/zookeeper3.4/bin/ [root@localhost bin] #. / zkCli.sh Connecting to localhost:2181 IV. Common operation commands # # create nodes [zk: localhost:2181 (CONNECTED) 2] create / cicadacicada- 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 the specified directory [zk: localhost:2181 (CONNECTED) 17] ls / zookeeper [com.ptp.user.service.UserService] # # Delete the node [zk: localhost:2181 (CONNECTED) 10] delete / cicada## delete all the directories [zk: localhost:2181 (CONNECTED) 18] rmr / cicada2 [zk: localhost:2181 (CONNECTED) 19] ls / cicada2Node does not exist: / cicada2## View the remaining nodes [zk: localhost:2181 (CONNECTED) 13] ls / [zookeeper] V. Source code address GitHub address https://github.com/cicadasmile/linux-system-baseGitEE address https://gitee.com/cicadasmile/linux-system-base
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.