File tree 1 file changed +3
-3
lines changed
docs/distributed-system/理论&算法
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 26
26
27
27
![ rsm-architecture] ( https://github.com/jun0315/JavaGuide/blob/raft-pic/media/pictures/raft/rsm-architecture.png?raw=ture )
28
28
29
- < center > 图-1 复制状态机架构</ center >
29
+ ` 图-1 复制状态机架构 `
30
30
31
31
一般通过使用复制日志来实现复制状态机。每个` Server ` 存储着一份包括命令序列的日志文件,状态机会按顺序执行这些命令。因为每个日志包含相同的命令,并且顺序也相同,所以每个状态机处理相同的命令序列。由于状态机是确定性的,所以处理相同的状态,得到相同的输出。
32
32
54
54
55
55
![ rsm-architecture] ( https://github.com/jun0315/JavaGuide/blob/raft-pic/media/pictures/raft/server-state.png?raw=ture )
56
56
57
- < center > 图-2:服务器的状态</ center >
57
+ ` 图-2:服务器的状态 `
58
58
59
59
### 2.2 任期
60
60
61
61
![ rsm-architecture] ( https://github.com/jun0315/JavaGuide/blob/raft-pic/media/pictures/raft/term.png?raw=ture )
62
62
63
- < center > 图-3:任期< center >
63
+ ` 图-3:任期 `
64
64
65
65
如图3所示,raft算法将时间划分为任意长度的任期(term),任期用连续的数字表示,看作当前term号。每一个任期的开始都是一次选举,在选举开始时,一个或多个Candidate会尝试成为Leader。如果一个Candidate赢得了选举,它就会在该任期内担任Leader。如果没有选出Leader,将会开启另一个任期,并立刻开始下一次选举。raft算法保证在给定的一个任期最少要有一个Leader。
66
66
You can’t perform that action at this time.
0 commit comments