Skip to content
/ NuRaft Public
forked from eBay/NuRaft

C++ implementation of Raft core logic as a replication library

License

Notifications You must be signed in to change notification settings

songpp/NuRaft

 
 

Repository files navigation

NuRaft

build codecov

Raft implementation derived from the cornerstone project, which is a very lightweight C++ implementation with minimum dependencies, originally written by Andy Chen.

New features that are not described in the original paper, but required for the real-world use cases in eBay, have been added. We believe those features are useful for others outside eBay as well.

Features

In the original cornerstone

  • Core Raft algorithm
    • Log replication & compaction
    • Leader election
    • Snapshot
    • Dynamic membership & configuration change
  • Group commit & pipelined write
  • User-defined log store & state machine support

New features added in this project

How to Build

1. Install cmake and openssl:

  • Ubuntu
$ sudo apt-get install cmake openssl libssl-dev libz-dev
  • OSX
$ brew install cmake
$ brew install openssl
  • Windows
    • Download and install CMake.
    • Currently, we do not support SSL for Windows.

2. Fetch Asio library:

  • Linux & OSX
$ ./prepare.sh
  • Windows
    • Clone Asio asio-1-12-0 into the project directory.
C:\NuRaft> git clone https://github.com/chriskohlhoff/asio -b asio-1-12-0

3. Build static library, tests, and examples:

  • Linux & OSX
$ mkdir build
$ cd build
build$ cmake ../
build$ make

Run unit tests

build$ ./runtests.sh
  • Windows:
C:\NuRaft> mkdir build
C:\NuRaft> cd build
C:\NuRaft\build> cmake -G "NMake Makefiles" ..\
C:\NuRaft\build> nmake

You may need to run vcvars script first in your build directory. For example (it depends on how you installed MSVC):

C:\NuRaft\build> c:\Program Files (x86)\Microsoft Visual Studio\2