This is a comprehensive system that simulate multiple servers’ consensus behavior at local machine using multi-process deployment.

Raft simulator with Golang

This project is a simulator for the Raft consensus protocol. It uses HTTP for inter-server communication, and a job scheduler for implementing polling logic.

Requirements:

  • go 1.17+
  • github.com/go-co-op/gocron 1.9.0+

Concepts

  • Actor: The state machine Raft describes. An actor is either a leader, follower, or candidate at a time. Each actor maintains a list of logs.

  • Server: Actor + communication methods.

How to run this project

  • First, run go build to build the project. GO will automatically download package requirements for you. If it does not, run go get github.com/go-co-op/gocron to install the dependency.
  • Running with config files:
    • If you wish to provide the server with some initial states, you can create a config file (see json files under actor_config for examples) and run ./main -f <config file name>
      • Note that the log of term 0 is required to avoid index out of bound problems
    • Or you can start a server with no logs at term 0. Run ./main -p <port number> -n <#peers> <peers...> E.g.: ./main -p 8080 -n 2 8081 8082
      • port_number: the port number you wish to have this server listen on for http traffic. E.g.: 8080
      • #peers: the number of peers you want to have in your deployment (excluding this one). E.g.: If you have 3 servers running, this number should be 2 for each of them
      • peers: list of port numbers for this server to send RPCs to. E.g.: If this server is on port 8080 and you have two other servers on 8081 and 8082, correspondingly, you should put 8081 8082 here

In order to be able to read the output logs for each server, we recommend to open a separate terminal window for each server.

How to append log to leader

Use postman or curl to send an http post request to http://localhost:<leader port number>/client-api with the following json-formatted payload:

{
    "req": "example command string"
}
Similar Resources

Flowgraph package for scalable asynchronous system development

flowgraph Getting Started go get -u github.com/vectaport/flowgraph go test Links Wiki Slides from Minneapolis Golang Meetup, May 22nd 2019 Overview F

Dec 22, 2022

Fast, efficient, and scalable distributed map/reduce system, DAG execution, in memory or on disk, written in pure Go, runs standalone or distributedly.

Gleam Gleam is a high performance and efficient distributed execution system, and also simple, generic, flexible and easy to customize. Gleam is built

Jan 1, 2023

High-Performance server for NATS, the cloud native messaging system.

High-Performance server for NATS, the cloud native messaging system.

NATS is a simple, secure and performant communications system for digital systems, services and devices. NATS is part of the Cloud Native Computing Fo

Jan 8, 2023

A distributed system for embedding-based retrieval

A distributed system for embedding-based retrieval

Overview Vearch is a scalable distributed system for efficient similarity search of deep learning vectors. Architecture Data Model space, documents, v

Dec 30, 2022

💡 A Distributed and High-Performance Monitoring System. The next generation of Open-Falcon

💡 A Distributed and High-Performance Monitoring System.  The next generation of Open-Falcon

夜莺简介 夜莺是一套分布式高可用的运维监控系统,最大的特点是混合云支持,既可以支持传统物理机虚拟机的场景,也可以支持K8S容器的场景。同时,夜莺也不只是监控,还有一部分CMDB的能力、自动化运维的能力,很多公司都基于夜莺开发自己公司的运维平台。开源的这部分功能模块也是商业版本的一部分,所以可靠性有保

Jan 5, 2023

a dynamic configuration framework used in distributed system

a dynamic configuration framework used in distributed system

go-archaius This is a light weight configuration management framework which helps to manage configurations in distributed system The main objective of

Dec 9, 2022

Verifiable credential system on Cosmos with IBC for Distributed Identities

Verifiable credential system on Cosmos with IBC for Distributed Identities

CertX This is a project designed to demonstrate the use of IBC between different zones in the Cosmos ecosystem for privacy preserving credential manag

Mar 29, 2022

A distributed and coördination-free log management system

A distributed and coördination-free log management system

OK Log is archived I hoped to find the opportunity to continue developing OK Log after the spike of its creation. Unfortunately, despite effort, no su

Dec 26, 2022

A distributed MySQL binlog storage system built on Raft

A distributed MySQL binlog storage system built on Raft

What is kingbus? 中文 Kingbus is a distributed MySQL binlog store based on raft. Kingbus can act as a slave to the real master and as a master to the sl

Dec 31, 2022
Golang implementation of the Raft consensus protocol

raft raft is a Go library that manages a replicated log and can be used with an FSM to manage replicated state machines. It is a library for providing

Jan 9, 2023
⟁ Tendermint Core (BFT Consensus) in Go
⟁ Tendermint Core (BFT Consensus) in Go

Tendermint Byzantine-Fault Tolerant State Machines. Or Blockchain, for short. Branch Tests Coverage Linting master Tendermint Core is Byzantine Fault

Dec 26, 2022
A naive implementation of Raft consensus algorithm.

This implementation is used to learn/understand the Raft consensus algorithm. The code implements the behaviors shown in Figure 2 of the Raft paper wi

Dec 3, 2021
Raft: a consensus algorithm for managing a replicated log

Raft Consensus Algorithm Raft is a consensus algorithm for managing a replicated

Dec 20, 2021
This is my implementation of Raft consensus algorithm that I did for own learning.

This is my implementation of Raft consensus algorithm that I did for own learning. Please follow the link to learn more about raft consensus algorithm https://raft.github.io. And Soon, I will be developing same algorithm in Java as well

Jan 12, 2022
Raft library Raft is a protocol with which a cluster of nodes can maintain a replicated state machine.

Raft library Raft is a protocol with which a cluster of nodes can maintain a replicated state machine. The state machine is kept in sync through the u

Oct 15, 2021
A feature complete and high performance multi-group Raft library in Go.
A feature complete and high performance multi-group Raft library in Go.

Dragonboat - A Multi-Group Raft library in Go / 中文版 News 2021-01-20 Dragonboat v3.3 has been released, please check CHANGELOG for all changes. 2020-03

Dec 30, 2022