Byraft is an implementation of Raft consensus algorithm in Ruby using gRPC.
gem install grpc
script/byraft # run server
script/client # request as client
Configuration
election timeout
: between 1 and 2 secheartbeat period
: 0.1 sec- Write committed commands in log/log-node-<id>.txt
- Nodes
- #1 on localhost:50051
- #2 on localhost:50052
- ...
Options
-n <number of nodes>
: default is 3-c <command>
: request command as client-v
: set logger level to DEBUG, otherwise INFO
Run servers in different terminals.
script/example 1 -n 5 # terminal 1
script/example 2 -n 5 # terminal 2
script/example 3 -n 5 # terminal 3
script/example 4 -n 5 # terminal 4
script/example 5 -n 5 # terminal 5
Run client to append log.
script/example 1 -c 'RUN COMMAND' # another terminal
bundle install
bundle exec rspec
- Liveness in the face of Network Faults
- Dynamic Membership