I'm too lazy to find a better name, so it is just a translation
A "bad" implementation of a raft consensus algorithm, just for fun.
scripts/ folder contains scripts to start nodes/cluster and clients:
start-node.sh: Starts a node with the given parameters, support a simple counter and a KV storekv-shell.sh: CLI to interact with the KV store
both support -h to show the help message.
./scripts/start-node.sh -id 1 -cluster-size 3 -kv-id can be any number, but it must be unique in the cluster.
-cluster-size make the node aware of the first N nodes in the cluster.
./scripts/kv-shell.shType help to see the available commands
curl http://localhost:8081/entriesThis needs to be done before starting it
curl -v http://localhost:8081/raft/request -d '{"type":"io.r.raft.protocol.LogEntry.ConfigurationChange","new":[{"id":"N4","host":"localhost","port":8084}]}' -H 'Content-Type: application/json'and then
./scripts/start-node.sh -id 4 -cluster-size 3 -kv# Get logs for a single node
cat .logs/test-logs.out| grep -E "NodeId=T1" | pbcopy
# Get Raft log dumps
cat .logs/test-logs.out | ggrep -oPz "(?s)Dump_log.*?End_Dump\s" | pbcopy
# Entries applied to state machine (replace T1 with actual node id)
cat .logs/test-logs.out| grep -E "NodeId=T1 \| _event=\"(Applied|Set-A)" | pbcopy