Raft Series Article Three: Raft RPC detailed

Source: Internet
Author: User

As mentioned in the previous article, the raft core only requires 2 rpc:requestvote and appendentries, this article describes the format and role of the two RPC.

Requestvote RPC is sent by candidate to other nodes, requesting other nodes to vote for themselves, and if a candidate obtains a majority of the node's votes, the candidate is converted to leader. Appendentries RPC is sent by the leader node to other nodes, there are two functions, when its entries domain is empty, the RPC as leader heartbeat, when the entries domain is not empty, Request the other node to add the log from the entries domain to its own log.

Each raft node will process the RPC requests based on the state data of its own node, so let's take a look at each of the raft nodes to save those state data:


Here is the format and description of the Appendentries RPC:


The following is the Requestvote RPC format and Description:


The above two RPCs are all RPC used in the Raft core section. The following is a list of the rules for RPC and state transitions for raft nodes in various states:



This article describes the detailed format and processing flow of the raft core RPC call, and the next article will explain the process of raft log replication in conjunction with the content described in this article.

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.