ZooKeeper基本理解

ZooKeeper主要是为分布式应用提供协同服务(A Distributed Coordination Service for Deistributed Applications)。我们可以考虑一下,如果让我们完成一个协同服务的设计应该如何完成呢?是不是可以有这么一个思路:可以先设定一个协同服务器,被协同的子节点定期的向该服务器汇报该节点的状态;当其他节点想要查询其他节点的状态时可以向协同服务器去查询,或者当某些事情发生时协同服务器主动去通知感兴趣的被协同节点。以我本身的理解,ZooKeeper也是按照这样的思路进行设计的。但是ZooKeeper考虑了高可靠性问题,即如果单点协同服务器宕掉了,该如何处理。ZooKeeper采用了备份的机制(replicated ),即采用多台协同服务器。多台系统服务器之间如何进行同步,接下来详细介绍。


ZooKeeper的数据模型(The ZooKeeper Data Model):

ZooKeeper将需要协调的节点按层次化进行组织,非常类似于标准的文件系统。一个节点由一系列由斜杠(/ slash)进行分割的路径表示,如下图所示。与标准文件系统不同的是,每一个节点既可以包含与自己相关的数据也可以包含子节点。



v ZooKeeper also has the notion of ephemeral nodes. These znodes exists as long as the session that created the znode is active. When the session ends the znode is deleted. Ephemeral nodes are useful when you want to implement [tbd].

v The replicated database is an in-memory database containing the entire data tree. Updates are logged to disk for recoverability, and writes are serialized to disk before they are applied to the in-memory database.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值