Guarantees
ZooKeeper is very fast and very simple. Since its goal, though, is to be a basis for the construction of more complicated services,
Sequential Consistency - Updates from a client will be applied in the order that they were sent.
Atomicity - Updates either succeed or fail. No partial results.
Single System Image - A client will see the same view of the service regardless of the server that it connects to.
Reliability - Once an update has been applied, it will persist from that time forward until a client overwrites the update.
Timeliness - The clients view of the system is guaranteed to be up-to-date within a certain time bound.
For more information on these, and how they can be used, see [tbd]
zookeeper的保证
One of the design goals of ZooKeeper is provide a very simple programming interface. As a result, it supports only these operations:
create
creates a node at a location in the tree
delete
deletes a node
exists
tests if a node exists at a location
get data
reads the data from a node
set data
writes data to a node
get children
retrieves a list of children of a node
sync
waits for data to be propagated
For a more in-depth discussion on these, and how they can be used to implement higher level operations, please refer to [tbd]
简单的操作API
zookeeper的设计原则之一就是提供简单的编程接口. 因此,他仅仅提供了以下几个操作.
1 创建 在目录结构树的某个位置创建一个节点
2 删除
删除某个节点
3 判断是否存在 判断某个位置上是否存在指定节点
4 获取数据 从节点中获取数据
5 设置/写入数据 写入数据到某个节点中
6 同步 等待写入数据传播到其他节点
想要进一步深入的探讨这些特性和操作,以及他们是如何实现更高级别的操作,请参看 tbd相关内容