This is simplified implementation of the Raft Consensus Algorithm. There is no log replication yet, current implementation can be used to do leader election.
The implementation supports the contract described there. It is recommended to run dashboard for watching changes.
go build ./...
go test ./...
The first argument is an address that node will bind to. The rest of the arguments are peers. To run 3 nodes that connect with each other:
go cmd/main.go localhost:9001 localhost:9002 localhost:9003
go cmd/main.go localhost:9002 localhost:9001 localhost:9003
go cmd/main.go localhost:9003 localhost:9001 localhost:9002
There are race conditions. All requests and events from timer should be processed on one queue to avoid concurrent modifications.