marco

v0.0.4
A skinny library for establishing leadership consensus among multiple nodes in a distributed network. Uses Redis pubsub for signaling. Great for distributed job runners/schedulers.
redis pub sub pubsub job jobs job runner scheduler and 7 more...

Marco

A skinny library for establishing leadership consensus among multiple nodes in a distributed network. Uses Redis pubsub for signaling.

Provides a good foundation for creating distributed job scheduling/running systems or other applications where master/slave roles need to be agreed upon by many nodes.

Installation

$ npm install marco

Example


var Marco = require('marco');

// Heroku Redistogo URL
var rtg = require('url').parse('redis://redistogo:[email protected]:14687/');

var jobDynoConfig = {
  redis: {
    port: rtg.port,
    hostname: rtg.hostname,
    auth: rtg.auth.split(':')[1]
  }
};

var marco = new Marco(jobDynoConfig);

marco.on('roleChange',function(data){
  console.log('There was a role change:',data);
  // $ There was a role change: {from:undefined,to:'scheduler',connected:[2839]}
});

marco.go();

npm i marco

Metadata

  • MIT
  • Whatever
  • Nicholas Crumrine
  • released 8/1/2017

Downloads

Maintainers