Project 1: Leader Election using the Raft Consensus Protocol

In Projects 1 and 2 you and a teammate will implement the Raft consensus protocol. In Project 1 you will implement enough of the protocol to perform leader election (everything but the log); you will also implement a simple remote shell. In Project 2 you will add the log to create a replicated state machine that executes shell commands.

For an introduction to Raft, please read the extended version of the Raft paper. For this course you will need to understand Sections 1-5 and the first part of Section 8 (finding the leader); you do not need to understand Sections 6 and 7 in detail. Over the course of Projects 1 and 2 you will implement all of the features described in Section 5.

Features

For Project 1, you must implement enough of the Raft protocol to start a cluster of servers, elect a leader, maintain leadership with heartbeats, and elect a new leader if the current leader fails or can't communicate with the other servers. Specifically, you must:

I recommend that you read through the Project 2 description before you start on Project 1. Knowing what you will need to implement in Project 2 may change how you implement Project 1, which will save you time later.

Additional Notes and Requirements

Development Environment

I strongly recommend using an integrated development environment (IDE) for the projects in this class. For example, Eclipse has good support for C++. Please configure your development environment so that indent widths are 4 spaces, and only space characters are stored in files, never tabs (this will make it easier for me to review your code: tab characters and/or 8-space indents result in very long lines in the code review tool).

I believe that you can use the following instructions to configure Eclipse for this:

Please keep your lines no longer than 80 characters in length. Long lines make code harder to read.

Submitting Your Project

To submit your project, push all of your changes to GitHub on a branch named project1. Then create a pull request on GitHub. The base for the pull request should be your master branch (which has nothing on it except your initial commit) and the comparison branch should be the head of your project1 branch. Use "Project 1" as the title for your pull request. If your project is not completely functional at the time you submit, describe what is and isn't working in the comments for the pull request.

If you are planning to use late days for this project (or any project) please send me an email before the project deadline so that I know how many late days you plan to use.

README file

I will download your GitHub repo and I may try running your code on my laptop. Please create a README file in the top-level directory of your project with instructions for how to run your server (e.g., how does each server know the names of the other servers?).