Giter Site home page Giter Site logo

moonshine_heartbeat's Introduction

Moonshine Heartbeat

Heartbeat is a tool for providing a high availibility resource (http, mysql, etc) from a set of two or more servers. You want heartbeat if:

  • You need high availability
  • Moving requests from one server to a hot spare at any point is acceptable in your application

We use this at Rails Machine for providing a hot spare for single points of failure, like software load balancers.

A plugin for Moonshine

This Moonshine plugin allows you to easily integrate heartbeat into your deployment.

Instructions

  • script/plugin install git://github.com/railsmachine/moonshine_heartbeat.git
  • Configure settings in config/moonshine.yml (see Configuration below)
  • Invoke the recipe(s) in the Moonshine manifest for your high availaibility resource recipe :heartbeat

Basic Configuration

A basic heartbeat setup with two haproxy servers would look something like this in moonshine.yml


  :heartbeat:
    :resources:
      :haproxy1: 12.34.56.80
    :nodes:
      :haproxy1: 12.34.56.78
      :haproxy2: 12.34.56.79
    :password: sekret

The resources key is a hash of preferred nodes and the resources that these nodes provide. In this case, we have two servers, haproxy1 and haproxy2. haproxy1 is the preferred (or primary) node. In this case, the resource that the primary node should present is an IP address - 12.34.56.80.

resources Requirements

  • The name of the preferred node must match the output of uname -n on that server.
  • All nodes below must have their firewall configured to allow incoming traffic on the ip address specified for the preferred node.

The nodes key is a hash of two or more nodes that will selected from to provide the high availibility resources specified in the resources hash. Their ip address is required here to setup heartbeat pings between them.

nodes Requirements

  • The name of the each node must match the output of uname -n on that server.

The password is a simple key used for each heartbeat server to authenticate with each other.

You'd then point your DNS to the high availibiltiy resource that heartbeat monitors - 12.34.56.80. If haproxy1 goes down, haproxy2 will take over this IP and continue serving requests. When haproxy1 comes back up, it'll take back the high availibility IP.

Advanced Configuration

Some examples of more custom configuration follow:


  :heartbeat:
    :resources:
      :haproxy1: -
        12.34.56.80
        haproxy
        god
    :nodes:
      :haproxy1: 12.34.56.78
      :haproxy2: 12.34.56.79
    :password: sekret
    :deadtime: 10
    :warntime: 5
    :initdead: 20
    :interface: eth1
    :udpport: 6009
    :auto_failback: no
    :ping: 12.34.56.1

Please see the "heartbeat wiki"[http://wiki.linux-ha.org/ha.cf] for more more information on these advanced config options.

Bcast/Ucast/Mcast

This plugin defaults to UDP ucast heartbeats because we've found them to be the most reliable. There is experimental (untested) support for mcast - see the ha.cf template on Github for details


Unless otherwise specified, all content copyright © 2014, Rails Machine, LLC

moonshine_heartbeat's People

Contributors

jnewland avatar kplawver avatar bryantraywick avatar

Stargazers

Lindsay Holmwood avatar

Watchers

James Cloos avatar James Koss avatar Ryan avatar  avatar Nicolas avatar Adrian Atanasov avatar Jeff Dols avatar  avatar

Forkers

bryantraywick

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.