In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "the installation and use of zookeeper". In the daily operation, I believe that many people have doubts about the installation and use of zookeeper. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "installation and use of zookeeper". Next, please follow the editor to study!
1 zookeeper data storage form
The user's data is stored in kv form in zookeeper.
Key: it is expressed in the form of a path, and each key has a parent-child relationship, such as / top-level key
The key created by the user can only be used as a child node under /. For example, the key of building a key: / aa can carry value data.
You can also build a key: / bb
You can also build multiple key: / aa/xx
In zookeeper, the key for each data is called a znode.
2 znode Typ
There are several types of znode in zookeeper:
1. PERSISTENT persistent: even if the creator is disconnected from the cluster, such nodes will persist in the zk cluster.
2. EPHEMERAL is short-lived: once the creator disconnects from the cluster, zk will delete this node
3. SEQUENTIAL with sequence number: for this kind of nodes, zk will automatically assemble a sequence number, and the sequence number is incremented.
Type of combination:
PERSISTENT: persistent without serial number
EPHEMERAL: temporarily without serial number
PERSISTENT and SEQUENTIAL: persistent and numbered
EPHEMERAL and SEQUENTIAL: short and numbered
3 install zookeeper
Extract the installation package zookeeper-3.4.6.tar.gz
Modify conf/zoo.cfg
# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use / tmp for storage / tmp here is just # example sakes.dataDir=/usr/local/bigdata/data/zkdata# the port at which the clients will connectclientPort=2181# the maximum number of 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 Autopurge feature#autopurge.purgeInterval=1server.1=Master:2888:3888server.2=Slave01:2888:3888server.3=Slave02:2888:3888
Create a directory / usr/local/bigdata/data/zkdata for all three nodes
For 3 nodes, generate myid files in the working directory, but the contents should be their respective id: 1, 2, 3
On Master: echo 1 > / usr/local/bigdata/data/zkdata/myidSlave01: echo 2 > / usr/local/bigdata/data/zkdata/myidSlave02: echo 3 > / usr/local/bigdata/data/zkdata/myid4 start the zookeeper cluster
Zookeeper does not provide automatic batch startup scripts, so you need to manually start the zookeeper process one by one on each node and run the command:
$bin/zkServer.sh start
After startup, you should be able to see a process with jps: QuorumPeerMain
View statu
$bin/zkServer.sh status5 write startup script zkmanage.sh
Zookeeper does not provide batch scripts, like hadoop can not start all nodes on a machine at the same time, you can write your own scripts to start batch.
$1: refers to receiving the first parameter
Run the command:
Sh zkmanage.sh start # start sh zkmanage.sh stop # stop 6 zookeeper command line client
Start the local client:
$bin/zkCli.sh
Start the client of another machine:
$bin/zkCli.sh-server Master:2181
Basic commands:
View help: help
Check the directory: ls /
View node data: get / zookeeper
Insert data: create / node data, such as create / aa hello
Change the data of a node: set / aa helloworld
Delete data: rmr / aa/bb
Register listener: get / aa watch-- > data changes will be notified; ls / aa watch-- > directories will also be notified of changes
At this point, the study on "installation and use of zookeeper" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.