Bully Algorithm Save

[Go] - Bully algorithm visualization & implementation written in Golang.

Project README

Bully Algorithm Visualization

intro logo

codecov CircleCI Go Report GoDoc License

Table of Contents

What this repository is about

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.

What is the Bully algorithm ?

The Bully algorithm is one of the simplest algorithm made to design a coordinator among a set of machines.

Quickstart

First, go get this repository:

go get -d github.com/timtosi/bully-algorithm

Quickstart with Docker

:exclamation: If you don't have Docker and Docker Compose installed, you still can execute this program by compiling the binaries.

This program comes with an already configured Docker Compose file launching five nodes and the browser based user interface.

You can use the run target in the provided Makefile to use it easily:

asciicast

You can access the visualization through your browser at localhost:8080. If you want to test the cluster behaviour, you can stop and resume some of the nodes with docker commands.

:bulb: If you want to update the number of node or change some IDs you will have to update the configuration file and the Docker Compose file accordingly.

Quickstart without Docker

First compiles and launch the visualization server:

cd $GOPATH/src/github.com/timtosi/bully-algorithm/cmd/data-viz
go build && ./data-viz

Visu

Then launch at least two nodes with specifying their ID in argument:

cd $GOPATH/src/github.com/timtosi/bully-algorithm/cmd/bully
go build && ./bully 0

:bulb: IDs should by default be comprised between 0 to 4 but you should be able to update peer address default configuration easily.

Nodes

You can access the visualization through your browser at localhost:8080.

FAQ

None so far :raised_hands:

License

Every file provided here is available under the MIT License.

Not Good Enough ?

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] !

Open Source Agenda is not affiliated with "Bully Algorithm" Project. README Source: TimTosi/bully-algorithm

Open Source Agenda Badge

Open Source Agenda Rating