Giter VIP home page Giter VIP logo

zookeeper-cluster-healer's Introduction

Cluster Healing with ZooKeeper

Y4S1 Distributed Systems ZooKeeper Assignment.

Introduction

An application which uses Apache ZooKeeper to monitor and automatically heal a cluster of workers. The cluster healer will launch the requested number of workers, then monitor the cluster to ensure that the requested number of workers is running. If a worker dies, the cluster healer should launch more workers to keep the total number of workers at the requested number.

Operation

On startup, the cluster healer:

  • Connects to ZooKeeper.

  • Checks if the /workers parent znode exists, and if it doesn't, creates it.

  • Starts the requested number of workers.

    • The number of workers and the path to the worker application are passed in as command-line arguments.
  • Watch the cluster to check if workers die.

    • Replacement workers are started when workers die.
    • The number of running workers should always be the requested number.

Workers

A worker application, faulty-worker.jar is included in this repository. On startup, this application connects to Zookeeper and creates an ephemeral, sequential znode called worker_ under the /workers parent znode, e.g. /workers /worker_0000001. This worker is programmed to continually crash at random intervals, which will cause the znode it created to be removed.

Building and Running the Application

Building

Use the maven package goal from the IntelliJ tool window to build an executable JAR.

Running

Running the below command from the project directory will start up 3 worker instances using the provided faulty-worker.jar, and will monitor the cluster to ensure that 3 instances are always running. Ensure that you've started the ZooKeeper server first.

java -jar target/cluster-healer-1.0-SNAPSHOT-jar-with-dependencies.jar 3 ../faulty-worker.jar

zookeeper-cluster-healer's People

Contributors

daniel-keogh avatar

Watchers

 avatar  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.