Consistency Algorithm Quest (Extended Version) 3

Source: Internet
Author: User

5 The Raft consensus algorithm

Raft is an algorithm for managing a replicated logs of the form described in section 2. Figure 2 summarizes the algorithm in condensed form for reference, and Figure 3 lists key properties of the algorithm; The elements of these figures is discussed piecewise over the rest of this section.

Raft implements consensus by first electing a distinguished leader, then giving the leader complete responsibility for mans Aging the replicated log. The leader accepts log entries from clients, replicates them on other servers, and tells servers when it's safe to apply Log entries to their state machines. Having a leader simplifies the management of the replicated log. For example, the leader can decide where to place new entries in the log without consulting other servers, and data flows In a simple fashion from the leader to other servers. A leader can fail or become disconnected from the other servers, with which case a new leader is elected.

Given the leader approach, Raft decomposes the consensus problem into three relatively independent subproblems, which is Discussed in the subsections that follow:

    • leader election:  a new leader must is chosen When an existing leader fails (Section 5.2).

    • log replication:  the leader must accept log Entries from clients and replicate them across the cluster, forcing the other logs-agree with their own (Section 5.3 ).

    • safety:  the key Safety property for Raft are the state machine Safety 3:if Any server have applied a particular log entry to it state machine, then no other server M ay apply a different command for the same log index. Section 5.4 Describes how Raft ensures the property; The solution involves an additional restriction on the election mechanism described in section 5.2.

After presenting the consensus algorithm, this section discusses the issue of availability and the role of timing in the S Ystem.

5 Consistency algorithm raft

Raft is an algorithm for managing log replication described in Chapter 2nd. Figure 2 provides a simple summary for reference, Figure 3 lists the key attributes of the algorithm, and the elements in these diagrams are discussed in other sections of this article.

Raft first selects an outstanding leader and then gives it full responsibility for managing the log copy to achieve consistency. The leader receives log entries from the client, copies them to other servers, and tells them that it is safe to get log entries from the state machine. Only one leader simplifies the management of log replication. For example, the leader does not need to communicate with other servers to determine the location of log entries against the log, and the traffic flows from leader to other servers in a simple way. A leader may be hung up or the link is broken, and a new leader will be elected.

Determine the leader strategy, raft the consistency issue into three separate sections, see the following discussion:

    • leader elections: The current leader must elect a new leader (Chapter 5.2) when it is hung.

    • Log copy:leader must receive log entries from the client and replicate in the cluster, forcing the replacement of different logs (Chapter 5.3).

    • Security: The key security attribute of the raft is the state machine Safety property in Figure 3: If a server passes a specific log entry to it, the other server can no longer pass different commands for the same log index. Chapter 5.4 Describes the raft to ensure this property, which contains an additional limitation of the electoral mechanism in Chapter 5.2.

Once the consistency algorithm is present, this section discusses usability issues and the role of timing in the system.


Consistency Algorithm Quest (Extended Version) 3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.