zookeeper 系列 官方翻译简介(四)
来源:互联网 发布:营口港数据 编辑:程序博客网 时间:2024/05/18 20:34
Nodes and ephemeral nodes
Unlike is standard file systems, each node in a ZooKeepernamespace can have data associated with it as well as children. Itis like having a file-system that allows a file to also be adirectory. (ZooKeeper was designed to store coordination data:status information, configuration, location information, etc., sothe data stored at each node is usually small, in the byte tokilobyte range.) We use the term znode to make it clear that we aretalking about ZooKeeper data nodes.
Znodes maintain a stat structure that includes version numbersfor data changes, ACL changes, and timestamps, to allow cachevalidations and coordinated updates. Each time a znode's datachanges, the version number increases. For instance, whenever aclient retrieves data it also receives the version of thedata.
The data stored at each znode in a namespace is read andwritten atomically. Reads get all the data bytes associated with aznode and a write replaces all the data. Each node has an AccessControl List (ACL) that restricts who can do what.
ZooKeeper also has the notion of ephemeral nodes. These znodesexists as long as the session that created the znode is active.When the session ends the znode is deleted. Ephemeral nodes areuseful when you want to implement [具体例子].
Conditional updates and watches
ZooKeeper supports the concept of watches. Clients can set awatch on a znodes. A watch will be triggered and removed when theznode changes. When a watch is triggered the client receives apacket saying that the znode has changed. And if the connectionbetween the client and one of the Zoo Keeper servers is broken, theclient will receive a local notification. These can be used to[tbd].
节点和临时节点
不像标准的文件系统,zookeeper 命名空间中的每个节点能够有数据关联,也有子节点.
就像文件系统一样,某个路径即可以是文件也可以是目录.(zookeeper被设计用来存储协调数据:
状态信息,配置信息,位置信息等等, 因此数据存储在每个节点中通常非常小,从几个字节到几千字节之间),
我们使用znode这个术语来使得我们讨论zookeeper数据节点时更加清晰明确.
znode管理着包含这一个状态结构数据,包含数据修改,ACL修改及时间戳的版本号, 允许缓存教育和协调更新.
每一次znode数据修改,版本号提升一次. 例如,无论何时客户端收到数据,同时都收到当前数据的版本.
每一个节点都有一个ACL访问控制列表,严格控制着谁能进行操作.
zookeeper也有会话级别的节点的语义支持,这些znode节点随着会话的创建而激活,会话的结束的时候节点被删除.
会话级别的节点在实现tbd的时候非常有用.
条件更新和监听
zookeeper支持监听, 客户端能够设置监听znode节点.当znode节点变更时可能触发或者移除监听.当监听事件被触发了,
客户端将会收到数据通知包,告诉客户端节点数据被修改了.同时如果当前客户端和zookeeper节点的连接被断开了.
客户端将收到一个本地通知. 这些特性都能用在 tbd 中
0 0
- zookeeper 系列 官方翻译简介(四)
- zookeeper 系列官方翻译简介(三)
- zookeeper 系列官方翻译简介(五)
- zookeeper系列(六) 官方翻译简介
- zookeeper系列(七) 官方翻译简介
- zookeeper系列(八) 官方翻译简介
- zookeeper 系列 官方翻译简介(一)
- zookeeper 系列 官方简介翻译(二)
- Apache Storm 翻译简介
- smartforms 翻译 SE63
- OJ 1040 翻译 Java
- zookeeper 系列,安装并使用zo…
- nodejs learnyounode pass 官方 An…
- SQL SERVER DMO 简介
- Apache Mahout 简介
- Linux Shell 简介
- Redis 简介 1
- Redis 简介 2
- storm-Understanding the&nbs…
- zookeeper 系列 官方翻译简介(一)
- zookeeper 系列 官方简介翻译(二)
- zookeeper 系列官方翻译简介(三)
- Apache Storm 翻译简介
- zookeeper 系列 官方翻译简介(四)
- Business English &ndas…
- 如何获取有价值的用户反馈?
- 深入解析C++中的mutable关键字
- jQuery弹出层效果,有关闭按钮
- 2-8-双循环链表链式存储结构-线性表-第2章-《数据结构》课本源码-严蔚敏吴伟民版
- 生成运行库,并运行它。
- 不细心造成的错误
- C++中如何产生均匀分布的随机数