美文网首页
Raft算法总结

Raft算法总结

作者: 6a91e15c5cde | 来源:发表于2018-03-20 11:34 被阅读83次

raft算法介绍

node节点的三种状态

一个node节点具有三种状态

  • Follower state
  • Condidate state
  • Leader state

选举过程

  • 领导人选举
  1. 所有节点开始时处于Follower state
    All our nodes start in the follower state
  2. 如果follower 没有听到过leader发来的消息,那么就可以成为condidate候选者.
    If followers don't hear from a leader then they can become a candidate.
  3. 候选者请求其他节点投票给自己。
    The candidate then requests votes from other nodes.
  4. 节点会以投票的方式回复。
    Nodes will reply with their vote.
  5. 如果候选者获得大多数节点的投票,他会成为领导者。
    The candidate becomes the leader if it gets votes from a majority of nodes.
  6. 领导人选举结束。
    This process is called Leader Election.
  • 数据一致性(日志复制)
  1. 到此系统的所有的变化都要经过领导者Leader;
  2. 每一次的变更节点都会记录节点日志;
  3. 如果节点日志没有提交,就不会更新其他节点的信息;
  4. 如果节点日志提交了,会将信息复制给其他follower;
  5. 然后节点等待大多数节点写入数据完成;
  6. 此时在将变更的数据提交到leader节点;
  7. 然后leader会通知follower信息已经提交;
  8. 到此为止,整个集群的数据达成了一致。
  9. 这个过程称为日志复制。
  • 候选人选举
    election timeout
    选举超时,follower等待成为condidate的时间
    超时时间被随机分配到150 ms到300毫秒之间
    一般在150 ms到300毫秒这个随机时间范围内会选举出condidate
    condidate 选举成功后,重新进入新的一路Leader选举。
  • 健康检查
    Leader和各个Follower之间维持一个心跳,当和某一个Follower之间的心跳停止,便重新开始新的一轮选举。

相关文章

  • Raft 算法浓缩

    Raft 算法浓缩总结 Raft 论文给出了下面的表格,用于总结 Raft 算法精华 。 实际上,这些精华都是一条...

  • Raft算法总结

    raft算法介绍 node节点的三种状态 一个node节点具有三种状态 Follower state Condid...

  • raft算法总结

    一、角色模型 (一) Raft-node 存在三种角色: 1、Follower:接受来自leader和Candid...

  • Raft算法解析

    什么是Raft算法? Raft算法是用于解决分布式系统中一致性问题的算法。在Raft算法之前,Lamport老爷爷...

  • 分布式共识算法

    导读: 拜占庭将军问题 1.概述 2.raft 一致性算法 2.1 raft算法选主流程 2.2 raft算法的数...

  • 共识算法:Raft

    共识算法:RaftRaft 官网Raft 原理动画 (推荐看看Raft 算法解析图片来源

  • raft算法笔记

    raft算法动画地址:http://thesecretlivesofdata.com/raft/raft是一个共识...

  • RAFT算法

    RAFT算法: RAFT算法引用原文论文翻译的第一句话:RAFT是一种为了管理复制日志的一致性算法(https:/...

  • Part 03:Raft论文翻译-《CONSENSUS: BRI

    3. 基础Raft算法 本章介绍了Raft算法。我们努力将Raft算法设计的更容易理解;第一部分描述了我们的可理解...

  • 图解Raft

    轻松理解Raft算法

网友评论

      本文标题:Raft算法总结

      本文链接:https://www.haomeiwen.com/subject/ugbvqftx.html