(Ii) the Zookeeper storage structure

A data structure

  zookeeper is a tree structure of a znode nodes, each node can contain sub nodes and data, and the client can monitor each node (i.e., set the monitor).

Second, znode type of (short-type and long-lasting type)

  When creating znode setting sequence identity , appends a value znode name, is a monotonically increasing sequence number counter, maintained by the parent node.

  1. Persistence of znode (once created will not be lost)

    create /aaa helloworld

  2. The order of znode (create a znode, the system will append your znode above a 10-digit number)    

     -S command to create sequential znode,  
create /aaa
create -s /aaa/b1 hello1
create -s /aaa/b2 hello2
ls /aaa

  3. temporary znode (ZooKeeper is down, or client within the time specified in the session is not connected server, will be considered lost)

    client -> server connection length [tcp] + session mechanism

    If you think client server crash or restart the zookeeper, znode client will delete previously created
     -E command to create a temporary znode  
     create  -e /aaa/b3 hello3
  + 4. Create a temporary order of nodes
    create -s -e /aaa/b4 hello4

Three, znode properties ( GET / aaa )

  Each node ZNode while storing data, are known to maintain a data structure of Stat, which stores information about all the states of the node.
  Transaction ID when creating czxid data node
  The creation of ctime time data node
  When the transaction ID data node mzxid last update
  Mtime time of last update node data
  pzxid data node subnode last transaction ID is modified when
  Changing the number of child nodes cversion
  Change the version number of the node data
  ACL's aversion to change the number of nodes
  ephemeralOwner If the node is a temporary node, the created session SessionID the node; if the node is a persistent node, the attribute value is 0
  The length of the data content dataLength
  The number of child nodes of the current node data numChildren


 

Guess you like

Origin www.cnblogs.com/tianxin945/p/12324032.html