Git Product home page Git Product logo

go-leader-election-bully-algorithm's Introduction

Leader-Election-Bully-Algorithm

Quickstart With Docker

Quickly set up and test the Bully Algorithm for leader election in distributed systems using Docker Compose. The provided Docker Compose file launches four nodes, allowing you to easily observe the cluster behavior.

Usage: Build and run Docker Compose:

docker-compose up --build Test the cluster behavior by killing nodes with Docker commands.

To add new nodes, update the hardcoded node addresses in the source code:

var nodeAddressByID = map[string]string{
    "node-01": "node-01:6001",
    "node-02": "node-02:6002",
    "node-03": "node-03:6003",
    "node-04": "node-04:6004",
}

This repository focuses on demonstrating leader election using the Bully Algorithm without implementing a full-fledged service discovery mechanism.

Quickstart without Docker

You can still execute this project without using Docker.

First, change the Node IPs. For example

var nodeAddressByID = map[string]string{
	"node-01": "node-01:6001", <--- change here to localhost:6001
	"node-02": "node-02:6002", <--- change here to localhost:6002
	"node-03": "node-03:6003", <--- change here to localhost:6003
	"node-04": "node-04:6004", <--- change here to localhost:6004
}

Second, you can set which node you want to run in Program arguments like

go run . node-02

go-leader-election-bully-algorithm's People

Contributors

jitender271 avatar

Stargazers

Andrea avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.