Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The zookeeper of big data's ecology (used by shell)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

The client that enters zk: zkCli.sh-server hadoop01:2181

Check the contents of the znode child node: ls /

Create znode node: create / zookeeper/node1 'content' (content must be added, otherwise the creation will not succeed)

Get znode data: get / ZooKeeper

Set znode data: set / zookeeper/node1 'content'

Listening for znode events: ls / ZooKeeper watch # registers listeners for child node change events of a node

Get / ZooKeeper watch # # registers listeners for a node's data content change event

Create a temporary znode node: create-e / zk/temp "myData"

Create sequential znode nodes: create-s / zk "myData"

Delete nodes: delete / zk # can only delete znode without child znode

Rmr / zk # delete all the znode no matter how many are in it

Connect zk:connect host:port

View the history of nodes command: history

View the status of the node: stat path

Note here to add: in the execution of the command: stat zenode_name information related introduction:

CZxid = 0x0 # zxid when the node was created

Ctime = Thu Jan 01 08:00:00 CST 1970 # time when the node was created

MZxid = 0x0 # zxid when the node is modified

Mtime = Thu Jan 01 08:00:00 CST 1970 # node modification time

PZxid = 0x0 # and the zxid corresponding to the creation / deletion of child nodes

Cversion =-1 # number of updates to child nodes

DataVersion = 0 # number of updates to node data

AclVersion = the number of updates to 0 # node (ACL)

EphemeralOwner = 0x0 # if the node is an ephemeral node, the ephemeralOwner value represents the session id bound to the node. If the node is not an ephemeral node, the ephemeralOwner value is 0, which is used to delete the temporary node when the client exits.

DataLength = 0 # bytes of node data

NumChildren = number of 1 # child nodes, excluding grandchild nodes

Key points:

① for ephemeralOwner: if it is a permanent node, value = 0x0. If it is a temporary node, every time zk enters the client, it will have a sessionid of the current client. If it is a temporary node, its ephemeralOwner value is equal to sessionid.

② zxid: the global unique identification of the current node, the global order is increasing, id is actually the identification, the global event submission order. Each time an event is submitted, it is incremented sequentially above the global maximum id. Zxid is used to identify the data version of each node in the entire distributed cluster. The higher the value, the newer the version.

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report