Skip to content
/ raft Public

An implementation of the Raft Consensus Algorithm

License

Notifications You must be signed in to change notification settings

IVIosab/raft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Raft Consensus

Table of Contents
  1. About The Project
  2. Built With
  3. Getting Started
  4. License
  5. Contact

About The Project

An implementation of the raft consensus algorithm that includes:

  • Leader Election
  • Log replication
  • Simple Client for testing

(back to top)

Built With

(back to top)

Getting Started

Dependencies

First you will need to install the dependencies in the requirements.txt file by running the following command in your terminal.

pip install -r requirements.txt

Then run the following code in the terminal

python3 -m grpc_tools.protoc raft.proto --proto_path=. --python_out=. --grpc_python_out=.

Testing

For testing you need to update the Config.conf file with the desired server addresses and ports. It follows the following schema: [id] [address] [port] Then you can run multiple servers in different terminals, for example:

gnome-terminal --window -x python3 client.py & gnome-terminal --window -x python3 server.py 0 & gnome-terminal --window -x python3 server.py 1 & gnome-terminal --window -x python3 server.py 2

This command will run the client and 3 servers with ids 0, 1, 2. in different terminal windows.

Then you can use the client terminal to run commands such as: [getleader, suspend, quit, getval, setval] Where: getleader: returns the current leader id and address suspend: takes one integer as an argument and suspends a server for that amount of time (in seconds) quit: terminates the client getval: takes one string as an argument and returns the value of the key with that key setval: takes a string and an integer as arguments and sets the value of the first key to the second value

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Mosab Mohamed - @IVIosab - mosab.f.r@gmail.com

Project Link: https://github.com/IVIosab/raft

(back to top)

Releases

No releases published

Packages

No packages published

Languages