Git Product home page Git Product logo

serf-case's Introduction

Serf Case

This case shows Hashicorp's Serf product.

Intro

Serf is a tool for:

  • Cluster Membership
  • Failure Detection
  • De-centralized Orchestration

Serf Benefits

  • Decentralized
  • Fault Tolerant
  • Self-Healing
  • Highly Available

Problem Solving

  1. Membership
  2. Failure Detection & Recovery
  3. Custom Event Propagation

Running the Agent

Starting Agent

serf agent

Checking Cluster members

serf members

Stopping Agent

Gracefully Leave

serf leave

or

Ctrl-C

Forcefully Leave

serf force-leave

Joining the Cluster

Starting multiple agents...

serf agent -node=agent-one -bind=127.20.20.10
serf agent -node=agent-one -bind=127.20.20.11

Telling 1st agent to join the 2nd agent will involve going into the 1st agent and telling it to join the 2nd agent:

serf join 127.20.20.11

You can check the status of agents after joining by Checking Cluster members

Leaving the Cluster

To leave just stop the agent you want to leave. See options in Stopping Agent section.

Events

Serf currently invokes the following types of events:

  1. member-join
  2. member-leave
  3. member-failed
  4. member-update
  5. member-reap
  6. user
  7. query

Event Handlers

Starting a Serf agent with the event handler.

serf agent -log-level=debug -event-handler=handler.sh

flagging the serf agent in log level debug mode so we can see the stdin/stderr of the events.

Custom Events

To send a custom event we simply do:

serf event [your custom event]

Custom Queries

E.g. to query the load

serf query load

which can then be combined with Custom Events' an Event Handler to send back responses. In this particular example, we can send back load times of machines.

serf-case's People

Contributors

colinbut avatar

Watchers

 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.