zookeeper学习小结

zookeeper's namespace


1、znode
    Znodes maintain a stat structure that includes version numbers for data changes, ACL changes, and timestamps.( znode节点的数据结构)
    The data stored at each znode in a namespace is read and written atomically.(读写的原子性)
    ZooKeeper also has the notion of ephemeral nodes,These znodes exists as long as the session that created the znode is active.(znode 的 暂存节点)
    ZooKeeper supports the concept of watches. Clients can set a watch on a znodes. (client 端对znode的观察)

znode 数据结构
    mtdata1     // znode 名称
    cZxid = 0x2   // 创建znode 的 zxid
    ctime = Tue Jan 22 23:12:22 CST 2013 // 创建时间
    mZxid = 0x3  // 修改znode 的 zxid
    mtime = Tue Jan 22 23:13:19 CST 2013  //修改时间
    pZxid = 0x2  // 
    cversion = 0  // znode 子节点版本号
    dataVersion = 1  // znode 数据版本号
    aclVersion = 0 // acl 版本号
    ephemeralOwner = 0x0 // 如果非0,表示拥有此ephemeral节点的session id 
    dataLength = 7  // znode 数据长度
    numChildren = 0 // 子节点个数

zxid = Zookeeper Transaction Id
zxid的存在,对znode 的每次修改连接事务,都有一个唯一的zxid(从小到大递增),zxid的大小可以反映事务的先后顺序,

2、read and write
Read requests are serviced from the local replica of each server database. (读请求访问当前server节点的本地副本)
As part of the agreement protocol all write requests from clients are forwarded to a single server, called the leader.(写请求被agreement protocal 转向到leader进行处理)

3、zookeeper successful used
https://cwiki.apache.org/confluence/display/ZOOKEEPER/PoweredBy

猜你喜欢

转载自dmouse.iteye.com/blog/1831491