This repository contains source code of an implementation of the bully algorithm written in Go and a small browser visualization tool.
This has been made for learning purposes about distributed algorithms, Bully algorithm being the simplest leader election algorithm to implement.
Finally, I feel like implementing an algorithm myself helps me to understands it better and I thought it could be interesting to someone else.
First, go get this repository:
go get -d github.com/timtosi/bully-algorithm
Then compiles and launch the visualization server:
cd $GOPATH/src/github.com/timtosi/bully-algorithm/cmd/data-viz
go build && ./data-viz
Finally launch two nodes with specifying their ID in argument:
cd $GOPATH/src/github.com/timtosi/bully-algorithm/cmd/bully
go build && ./bully 0
You can access the visualization through your browser at localhost:8080
.
The Bully algorithm is one of the simplest algorithm made to design a coordinator among a set of machines.
Every file provided here is available under the MIT License.
If you encouter any issue by using what is provided here, please let me know ! Help me to improve by sending your thoughts to [email protected] !