Raft简述
发布日期:2021-05-10 01:23:27 浏览次数:20 分类:精选文章

本文共 4111 字,大约阅读时间需要 13 分钟。

Raft���������������������������������������������������������������������������������������Multi-Paxos������������������������������Leader���������������������������������������Raft���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������

������

������ ������ ���������
currentTerm ���������������������������������������0��������������� ������
VoteFor ���������������������������������������ID������������null��� ������
log[] ���������������������������command, term���������������1������ ������
commitIndex ������������������������������������������0��������������� ���������
lastApplied ���������������������������������������������������0��������������� ���������
nextIndex[] ��������������������������������������������������������������������� ���������������������
matchIndex[] ������������������������������������������������������������������0��������������� ���������������������

RPC������

  • AppendEntries RPC
    • ���������������������������������������������������������������������������������
  • RequestVote RPC
    • ������������������������������������������
  • ���������������

    ���������������

  • ������ commitIndex > lastApplied��������� lastApplied ������������������������������ log[lastApplied]���
  • ������ RPC ��������������������������������� T ������ currentTerm������������ currentTerm ��� T��������������������������������� "Follower"���
  • Follower���������������

  • ������������������������������������ RPC���
  • ��������������������������������� electionTimeout ������������������������������������������ AppendEntries RPC ������������������������������������������������������������
  • Candidate���������������

  • ������������������������������������������
    • ������ currentTerm���
    • ������������������
    • ������������������������
    • ������������������������ RequestVote RPC���
  • ������������������������������������������������������������
  • ��������������������������� AppendEntries RPC��������������������������� "Follower" ���������
  • ���������������������������������������������������������������������������
  • Leader���������������

  • ���������������������
    • ������������������������������ AppendEntries RPC���������������
    • ������������������������������������������������
  • ������������������������
    • ������������������������������������������������������������
  • ������ Follower���
    • ������ Follower ��� lastApplied ������������������������������������������nextIndex��������������� AppendEntries RPC ������ nextIndex ���������������������
    • ��������������� nextIndex ��� matchIndex���
    • ��������������������������������������������������� nextIndex ������������������
  • ������ commitIndex ���������������������������������������������
    • ������������ N ���������
      • N > commitIndex
      • matchIndex[i] >= N ���������������������������
      • log[N].term == currentTerm���
  • ���������������

    ��������������������������� "Follower"���Follower ������������������������������ electionTimeout ���������������������������������

  • ������ currentTerm��������������� "Candidate"���
  • ������������������������ RequestVote RPC���
  • ���������������������
    • ������������������������
    • ������������������������������������ "Follower"���
    • ���������������������������������������������������������������������������
  • ������������

  • ������������������������������������������������������������������������������������������������������
  • ���������������
    • ������������������������������������������������
    • ������������������������������������������
  • ���������

  • ������������������������������������������������������������
  • ������������������������������������������������������������������������������������������
  • Follower/Candidate ������������������������������������������������ RPC���������������������������
  • ������������������

  • ������������������������������������������������������������������������������������������������������������������
  • ������������������������������������������������������������������������������������������������������������
  • ���������������������Raft ������������������������������������������������������������������������������������������������

    上一篇:快速理解脏读、不可重复读、幻读和MVCC
    下一篇:C++进制转换、字符串转数字

    发表评论

    最新留言

    关注你微信了!
    [***.104.42.241]2025年04月22日 14时20分22秒