My implementation of the Raft distributed consensus protocol in Go, as described by the Raft paper. This implementation supports all features described in the paper, except for snapshotting and cluster membership changes.
- Clone the Git repository, build Raft
git clone https://github.com/ludanik/raft.git
cd raft
make build- Start a Raft cluster. Open three terminal windows and run the Raft node on each.
# Terminal window 1:
./bin/raft --cluster="1:3001,2:3002,3:3003" --node=1
# Terminal window 2:
./bin/raft --cluster="1:3001,2:3002,3:3003" --node=2
# Terminal window 3:
./bin/raft --cluster="1:3001,2:3002,3:3003" --node=3- Build the container and deploy it to a running Kubernetes cluster. You will need to write a deployment.yaml for your cluster.
docker build -t github.com/ludanik/raft .
kubectl apply -f deployment.yaml- Get the pod name and view its output
kubectl get pods
kubectl logs -f POD_NAMETo regenerate Protobuf files
protoc --go_out=. --go-grpc_out=. raft.proto