本文次要记录一个zookeeper node详细信息的各项参数的含意

官网文档: ZooKeeper Stat Structure

参数解释中文解读
czxidThe zxid of the change that caused this znode to be created.批改这个节点时的zxid号
mzxidThe zxid of the change that last modified this znode.批改这个节点时的zxid号
pzxidThe zxid of the change that last modified children of this znode.批改这个节点给它增加子节点时的zxid号
ctimeThe time in milliseconds from epoch when this znode was created.节点的创立工夫
mtimeThe time in milliseconds from epoch when this znode was last modified.节点的批改工夫
versionThe number of changes to the data of this znode.节点变更的版本号
cversionThe number of changes to the children of this znode.该节点的子节点的更新次数
aversionThe number of changes to the ACL of this znode.这个节点的ACL的变更次数
ephemeralOwnerThe session id of the owner of this znode if the znode is an ephemeral node. If it is not an ephemeral node, it will be zero.如果是长期节点,那么创立这个节点的session id号
dataLengthThe length of the data field of this znode.这个节点的数据的长度
numChildrenThe number of children of this znode.这个节点的子节点数量

代码演示

[zk: localhost:2181(CONNECTED) 3] create /p1 thinktikCreated /p1[zk: localhost:2181(CONNECTED) 4] stat /p1cZxid = 0x58ctime = Mon Feb 15 23:42:57 CST 2021mZxid = 0x58mtime = Mon Feb 15 23:42:57 CST 2021pZxid = 0x58cversion = 0dataVersion = 0aclVersion = 0ephemeralOwner = 0x0 # 非长期节点的值固定为0x0,长期节点会有seesion iddataLength = 8   # 该节点的长度为为8,也是就thinktik的长度numChildren = 0  # 子节点个数为0[zk: localhost:2181(CONNECTED) 5] create /p1/s1 thinkCreated /p1/s1[zk: localhost:2181(CONNECTED) 6] stat /p1cZxid = 0x58ctime = Mon Feb 15 23:42:57 CST 2021mZxid = 0x58mtime = Mon Feb 15 23:42:57 CST 2021pZxid = 0x59 # 子节点被创立时的zxidcversion = 1 # 子节点批改了1次dataVersion = 0aclVersion = 0ephemeralOwner = 0x0dataLength = 8numChildren = 1 # 子节点个数为1[zk: localhost:2181(CONNECTED) 11] create /p1/s2 think2Created /p1/s2[zk: localhost:2181(CONNECTED) 12] stat /p1cZxid = 0x58ctime = Mon Feb 15 23:42:57 CST 2021mZxid = 0x58mtime = Mon Feb 15 23:42:57 CST 2021pZxid = 0x5ccversion = 2  # 子节点批改了2次dataVersion = 0aclVersion = 0ephemeralOwner = 0x0dataLength = 8numChildren = 2  # 子节点个数为2

实际上的官网文档和代码演示有轻微的区别,然而区别不大

本文原创链接: zookeeper 节点信息解读