/RaftKeeper

RaftKeeper is a high-performance distributed consensus service.

Primary LanguageC++Apache License 2.0Apache-2.0

logo.png

RaftKeeper is a high-performance distributed consensus service. It is fully compatible with Zookeeper and can be accessed through the Zookeeper client. It implements most of the functions of Zookeeper (except: Container node, TTL node, quota etc.) and provides some additional functions, such as more monitoring indicators, manual Leader switching and so on.

RaftKeeper provides a multi-thread processor for performance consideration. But also it provides below guarantee:

  1. Requests response must be returned in order in one session.
  2. All committed write requests must be handled in order, across all sessions.

RaftKeeper data resides in memory and provides snapshot + operation log data persistence capabilities. The execution framework adopts pipeline and batch execution methods to greatly improve system throughput, see Benchmark for details.

RaftKeeper is derived from ClickHouse and take NuRaft as Raft implementation. We really appreciate the excellent work of the ClickHouse and NuRaft team.

How to start?

1. Build RaftKeeper

Build on macOS

Requirement: macOS 10+, Clang 13+, Cmake 3.12+

# install tools
brew install cmake llvm@13
 
# clone project
git clone https://github.com/JDRaftKeeper/RaftKeeper.git
git submodule sync && git submodule update --init --recursive
 
# build project
export CC=/usr/local/opt/llvm@13/bin/clang CXX=/usr/local/opt/llvm@13/bin/clang++
cd RaftKeeper && sh build.sh

Build on Ubuntu

Requirement: Ubuntu20.04+, Clang 13+, Cmake 3.12+

# install tools
sudo apt-get install cmake llvm-13
 
# clone project
git clone https://github.com/JDRaftKeeper/RaftKeeper.git
git submodule sync && git submodule update --init --recursive
 
# build project
export CC=/usr/bin/clang-13 CXX=/usr/bin/clang++-13
cd RaftKeeper && sh build.sh

2. Deploy RaftKeeper

Deploy a three nodes cluster.

# use tar.gz file in step 1.
tar -xzvf RaftKeeper.tar.gz
 
# configure it: replace my_id under <my_id> 
# If you deploy a multi nodes cluster, configure id & host under <cluster>. 
#     Pls note that nodes must has different id.
vim RaftKeeper/conf/config.xml
 
# start it
cd RaftKeeper/bin && sh start.sh

3. Access RaftKeeper

You can use ZooKeeper's shell client zkCli.sh to access to RaftKeeper, or you can use Java, python or C ZooKeeper clients to access. Also, RaftKeeper supports Zookeeper's 4lw command.

How to migrate from Zookeeper?

RaftKeeper provides tool to translate Zookeeper data to RaftKeeper format. So you can simply move data into RaftKeeper, detail is in migrate-from-zookeeper.