1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-24 12:32:21 +00:00
This commit is contained in:
chai2010 2018-07-22 08:09:32 +08:00
commit e57aafd85a
2 changed files with 8 additions and 2 deletions

View File

@ -54,7 +54,7 @@
* [5.11. Load-balance负载均衡](ch5-web/ch5-11-load-balance.md) * [5.11. Load-balance负载均衡](ch5-web/ch5-11-load-balance.md)
* [第六章 分布式系统](ch6-cloud/readme.md) * [第六章 分布式系统](ch6-cloud/readme.md)
* [6.1. 云上地鼠(TODO)](ch6-cloud/ch6-01-cloud.md) * [6.1. 云上地鼠(TODO)](ch6-cloud/ch6-01-cloud.md)
* [6.2. 分布式搜索引擎(Doing)](ch6-cloud/ch6-02-dist-search-engine.md) * [6.2. 分布式搜索引擎](ch6-cloud/ch6-02-dist-search-engine.md)
* [6.2. Raft协议(TODO)](ch6-cloud/ch6-02-raft.md) * [6.2. Raft协议(TODO)](ch6-cloud/ch6-02-raft.md)
* [6.3. 分布式哈希(TODO)](ch6-cloud/ch6-03-hash.md) * [6.3. 分布式哈希(TODO)](ch6-cloud/ch6-03-hash.md)
* [6.4. 分布式队列(TODO)](ch6-cloud/ch6-04-queue.md) * [6.4. 分布式队列(TODO)](ch6-cloud/ch6-04-queue.md)

View File

@ -1,3 +1,9 @@
# 6.2. Raft协议 # 6.2. Raft协议
TODO raft 是一种分布式一致性算法,其能够保证在 2n+1 的系统,有 n+1 以上的节点存活时,向集群中写入的数据保证不会丢失。相比 paxos其有更好的易读性和简洁性所以从诞生起便受到很多人的赞许。该算法与 paxos 类似,被广泛应用于分布式调度的元信息存储,或在存储领域进行日志复制。
开源界使用最为广泛的实现是基于 raft 实现的 etcd、consul不过 etcd 的 raft 和自身强绑定我们如果只是想使用算法的话并不是很方便。hashicorp 为我们直接开源了 raft 的算法库 `https://github.com/hashicorp/raft`,本节中,我们将基于该库实现几个小工具。
## 实现分布式状态机
## 实现分布式日志复制