Giter Club home page Giter Club logo

zookeeper-leader-election's Introduction

Author: Alan Perez-Rathke ([email protected])

This is a simple implementation of the ZooKeeper leader election algorithm as outlined here:

http://zookeeper.apache.org/doc/trunk/recipes.html#sc_leaderElection

Classes:

*ZooElectableClient:
- An abstract ZooKeeper client that implements the leader election algorithm.
- The method performRole() must be implemented in a child class.  This function is intended to
contain the work that the client node must actually perform (conditioned on whether or not it
is the leader).

*ZooTestElectableClient:
- A simple demo ZooKeeper client that simply outputs its state after any leader election.

*ZooZNodeDeletionMonitor: Based on http://zookeeper.apache.org/doc/current/javaExample.html#ch_Introduction
- A monitor that watches for znode deletion and informs its listener when this occurs

Scripts (*nix):

./build.sh - will compile the java sources
./run.sh - will run an instance of the test client

Usage:

The clients assume that a server is running in the background. See:

http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html

for documentation on downloading and starting a ZooKeeper server.  To demo, run multiple
client instances (each in separate terminal windows), then kill the leader instance to
observe a new leader election.

zookeeper-leader-election's People

Watchers

James Cloos avatar Rahul Subramaniam avatar Himanshu Khurana avatar  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.