高可用性

High availability - fault tolerant

Useful link

work

  • using Redundancy and Replication to reach fault tolerant

Raft

  • key point
    • leader
      • control the whole process, interact with clients
    • candidate
      • if cannot receive heartbeat from leader, wait for a random timeout to be cadidate
    • follower

Leader election

  • two timeout

    • election timeout
      • is the amount of time a follower waits until becoming a candidate.
      • then it assumes there is no viable leader and begins an election to choose a new leader
      • randomized to be between 150ms and 300ms.
      • After the election timeout the follower becomes a candidate and starts a new election term
      • sends out Request Vote messages to other nodes.
    • heartbeat timeout
      • leader sends heartbeat messages to all of the other servers to establish its authority and prevent new elections.
  • Leader

    • once get majority votes, leader begins sending out Append Entries messages to its followers.
      • send in intervals specified by the heartbeat timeout
    • if node cannot receive heartbeat, then become a candidate and re-election
    • Requiring a majority of votes guarantees that only one leader can be elected per term.
  • split vote

    • if two or more candidates receive same votes
    • The nodes will wait for a new election and try again.

log replicate

  • This is done by using the same Append Entries message that was used for heartbeats.
  • committed
    • The leader decides when it is safe to apply a log entry to the state machines; such an entry is called committed.
    • Raft guarantees that committed entries are durable and will eventually be executed by all of the available state machines.
  • once new entry committed
    • leader executes command in its state machine ,return result to client
    • leader notifies followers of committed entries in subsequent AppendEntries RPCs
    • followers execute committed commands in their state machines
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值