In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Ls & ls2 command
Ls # View current directory node ls / view child nodes of the root directory
There is a child node under / as follows
Ls / zookeeper # View / zookeeper sub-node
Ls / watch # watch means to register for listening. Zookeeper will not notify you until the root directory has changed. If you do not register, you will not be notified. This is to monitor the change of the child node (the change of the path), and the monitoring is only valid once.
We listened to /, and when we created the lxp child node under "/", we were told that 123 is the content stored by the lxp node.
Ls2 views the details of the node
Ls2 / lxp view detailed node information, view data details
Create command
Create / tt123 abcdef # when we create a node, we write the full path of the node, followed by the content stored by the node (abcdef).
-s creates a node with a sequence number, and the sequence number is incremented globally
The role of the sequence number: in a distributed system, the sequence number can be used to globally sort all events, so that the client can judge the order of the events by the sequence number, that is, when the client connection is made, which client first establishes the link according to the sequence number.
-e is to create a short-lived node. The node will be deleted automatically when client is disconnected from zk.
Create-e / lxp 123will be used when the server is dynamically online and offline.
Get command to get node data:
Listening for changes in Node data get / lxp watch
1 、
2 、
3 、
4 、
The monitoring function is only valid once. Above, we have already monitored "/ lxp". We have informed the client when the / lxp set is 123, but when we modify it again, when we set the "/ lxp" set to "456", we will not be informed. There is no watcher, and it will be re-monitored only when we register.
Modify the value of a node: set command
Set / lxp "liuxipeng"
Delete nodes: delete command
Recursive deletion: rmr command
Interpretation of zk Node Information (understanding)
[zk: localhost:2181 (CONNECTED) 4] ls2 /
[zookeeper, lxp]
CZxid = 0x0 # create node's transactional zxid (zxid is transactional id)
Ctime = Thu Jan 01 08:00:00 CST 1970 # Node creation time
MZxid = 0x0 # Last updated transaction zxid
Mtime = Thu Jan 01 08:00:00 CST 1970 # time of the last update
PZxid = 0x300000010 # transaction zxid for the last update of the child node
Cversion = 12 # child node change sign, the number of times znode child node has been modified
DataVersion = 0 data change number, how many versions have been changed
AclVersion = 0 # how many times has the change number of the access control list changed
EphemeralOwner = 0x0 # if temporary node is session id, if not temporary node is 0
DataLength = 0 # length of znode data
NumChildren = number of 2 # child nodes
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.