1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-29 06:41:32 +08:00

update zookeeper

This commit is contained in:
guide 2020-08-26 16:56:34 +08:00
parent 5f37392130
commit 7a8f9b1622
8 changed files with 7 additions and 7 deletions

View File

@ -331,9 +331,9 @@ SSO(Single Sign On)即单点登录说的是用户登陆多个子系统的其中
> 前两篇文章可能有内容重合部分,推荐都看一遍。
1. [【入门】ZooKeeper 相关概念总结 01](docs/system-design/framework/zookeeper-intro.md)
2. [【进阶】ZooKeeper 相关概念总结 02](docs/system-design/framework/zookeeper-plus.md)
3. [【实战】ZooKeeper 实战](docs/system-design/framework/zookeeper-in-action.md)
1. [【入门】ZooKeeper 相关概念总结 01](docs/system-design/framework/zoozookeeper-intro.md)
2. [【进阶】ZooKeeper 相关概念总结 02](docs/system-design/framework/zookeeper/zookeeper-plus.md)
3. [【实战】ZooKeeper 实战](docs/system-design/framework/zookeeper/zookeeper-in-action.md)
#### 其他

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@ -111,7 +111,7 @@ ZooKeeper 数据模型采用层次化的多叉树形结构,每个节点上都
从下图可以更直观地看出ZooKeeper 节点路径标识方式和 Unix 文件系统路径非常相似,都是由一系列使用斜杠"/"进行分割的路径表示,开发人员可以向这个节点中写人数据,也可以在节点下面创建子节点。这些操作我们后面都会介绍到。
![ZooKeeper 数据模型](https://images.gitbook.cn/95a192b0-1c56-11e9-9a8e-f3b01b1ea9aa)
![ZooKeeper 数据模型](images/znode-structure.png)
### 3.2. znode数据节点
@ -204,7 +204,7 @@ ZooKeeper 采用 ACLAccessControlLists策略来进行权限控制类似
Watcher事件监听器是 ZooKeeper 中的一个很重要的特性。ZooKeeper 允许用户在指定节点上注册一些 Watcher并且在一些特定事件触发的时候ZooKeeper 服务端会将事件通知到感兴趣的客户端上去,该机制是 ZooKeeper 实现分布式协调服务的重要特性。
![watcher机制](https://guide-blog-images.oss-cn-shenzhen.aliyuncs.com/2020-8/watcher%E6%9C%BA%E5%88%B6.jpg)
![watcher机制](images/watche机制.png)
_破音非常有用的一个特性都能出小本本记好了后面用到 ZooKeeper 基本离不开 Watcher事件监听器机制。_
@ -220,7 +220,7 @@ Session 有一个属性叫做:`sessionTimeout` `sessionTimeout` 代表会
为了保证高可用,最好是以集群形态来部署 ZooKeeper这样只要集群中大部分机器是可用的能够容忍一定的机器故障那么 ZooKeeper 本身仍然是可用的。通常 3 台服务器就可以构成一个 ZooKeeper 集群了。ZooKeeper 官方提供的架构图就是一个 ZooKeeper 集群整体对外提供服务。
![](http://my-blog-to-use.oss-cn-beijing.aliyuncs.com/18-9-10/68900686.jpg)
![](images/zookeeper集群.png)
上图中每一个 Server 代表一个安装 ZooKeeper 服务的服务器。组成 ZooKeeper 服务的服务器都会在内存中维护当前的服务器状态,并且每台服务器之间都互相保持着通信。集群间通过 ZAB 协议ZooKeeper Atomic Broadcast来保持数据的一致性。
@ -230,7 +230,7 @@ Session 有一个属性叫做:`sessionTimeout` `sessionTimeout` 代表会
但是,在 ZooKeeper 中没有选择传统的 Master/Slave 概念,而是引入了 Leader、Follower 和 Observer 三种角色。如下图所示
![](http://my-blog-to-use.oss-cn-beijing.aliyuncs.com/18-9-10/89602762.jpg)
![](images/zookeeper集群中的角色.png)
ZooKeeper 集群中的所有机器通过一个 **Leader 选举过程** 来选定一台称为 “**Leader**” 的机器Leader 既可以为客户端提供写服务又能提供读服务。除了 Leader 外,**Follower** 和 **Observer** 都只能提供读服务。Follower 和 Observer 唯一的区别在于 Observer 机器不参与 Leader 的选举过程,也不参与写操作的“过半写成功”策略,因此 Observer 机器可以在不影响写性能的情况下提升集群的读性能。