Skip to content
forked from PikaLabs/floyd

A raft consensus implementation that is simply and understandable

License

Notifications You must be signed in to change notification settings

shiyezheng/floyd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Floyd 中文

Floyd is an C++ library based on Raft consensus protocol.

  • Raft is a consensus algorithm which is easy to understand;
  • Floyd is an library that could be easily embeded into users' application;
  • Floyd support consistency between cluster nodes by APIs like Read/Write/Delete;
  • Also we support direct access to data without consistency: DirtyRead/DirtyWrite;
  • Also some query and debug managment APIs: GetLeader/GetServerStatus/set_log_level

Users

  • Floyd has provided high available store for Meta cluster of Zeppelin , which is a huge distributed key-value storage.
  • The list will goes on.

Why do we prefer a library to a service?

When we want to coordinate services, ZooKeeper is always a good choice.

  • But we have to maintain another service.
  • We must use its' SDK at the same time.

In our opion, a single service is much more simple than two services. As a result, an embeded library could be a better choice.

Floyd's Features and APIs

type API Status
Consensus Read support
Consensus Write support
Consensus Delete support
Consensus Lock working
Consensus UnLock working
Consensus GetLease working
Local DirtyRead support
Local DirtyWrite support
Query GetLeader support
Query GetServerStatus support
Debug set_log_level support
  • Raft fetaures
Language Leader election + Log Replication Membership Changes Log Compaction
C++ Yes No No

Compile and Have a Try

  • Dependencies

    • gcc version 4.8+ to support C++11.
    • protobuf-devel
    • snappy-devel
    • bzip2-devel
    • zlib-devel
    • bzip2
    • submodules:
    1. Get source code and submodules recursively.
git clone --recursive https://github.com/Qihoo360/floyd.git
    1. Compile library make
    1. Compile example make test
    1. run example/server groups
cd exampler/server
./output/bin/floyd_node --servers 127.0.0.1:9100,127.0.0.1:9101,127.0.0.1:9102 --local_ip 127.0.0.1 --local_port 9100 --sdk_port 8900 --data_path ./node1/data --log_path ./node1/log
./output/bin/floyd_node --servers 127.0.0.1:9100,127.0.0.1:9101,127.0.0.1:9102 --local_ip 127.0.0.1 --local_port 9101 --sdk_port 8901 --data_path ./node2/data --log_path ./node2/log
./output/bin/floyd_node --servers 127.0.0.1:9100,127.0.0.1:9101,127.0.0.1:9102 --local_ip 127.0.0.1 --local_port 9102 --sdk_port 8902 --data_path ./node3/data --log_path ./node3/log
    1. run client
# ./floyd_client
Usage:
  ./client --server ip:port
           --cmd [read | write | delete | status | debug_on | debug_off]
           --begin id0 --end id1
# ./floyd_client --server 127.0.0.1:8901 --cmd status --begin 0 --end 1

Documents

Contant us

About

A raft consensus implementation that is simply and understandable

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 86.0%
  • Makefile 8.3%
  • Shell 2.3%
  • C 2.1%
  • Protocol Buffer 1.3%