Git Product home page Git Product logo

deepstream.io-cluster's Introduction

Deepstream.io Cluster

Community supported clustering for deepstream.io. Based on Nanomsg.

CircleCI npm version

Usage

yarn install deepstream.io-cluster

The deepstream.io-cluster module extends the base deepstream.io.

Peers bootstrap off of each other.

Server A, 192.168.1.1

const Deepstream = require('deepstream.io-cluster');

const server = new Deepstream();

Server B, 192.168.1.2

const Deepstream = require('deepstream.io-cluster');

const server = new Deepstream({
  cluster: {
    peerAddresses: [
      {
        host: '192.168.1.1'
      }
    ]
  },
});

Server C, 192.168.1.3

const Deepstream = require('deepstream.io-cluster');

const server = new Deepstream();

server.addPeer({host: '192.168.1.1'});

Options

const Deepstream = require('deepstream.io-cluster');

const server = new Deepstream({
  cluster: {
    bindAddress: {
      host: '127.0.0.1', // Optional, default '127.0.0.1'
      pubsubPort: 6021, // Optional, default 6021
      pipelinePort: 6022, // Optional, default 6022
    },
    peerAddresses: [
      {
        host: '127.0.0.1', // Required
        pubsubPort: 6021, // Optional, default 6021
        pipelinePort: 6022, // Optional, default 6022
      }
    ]
  },
});

Methods

server.addPeer({
  host: '192.168.1.2', // Required
  pubsubPort: 6021, // Optional, default 6021
  pipelinePort: 6022, // Optional, default 6022
});
// Returns a Promise.

server.removePeer({
  host: '192.168.1.2', // Required
  pubsubPort: 6021, // Optional, default 6021
  pipelinePort: 6022, // Optional, default 6022
});

Automatic peer discovery with node-discover

const options = {}; // See options at https://github.com/wankdanker/node-discover#constructor

// Returns a Promise.
server.startPeerDiscovery(options);

// later
server.stopPeerDiscovery();
server.getPeers();

// Returns:
//
// [
//   {
//     serverName: "server-2",
//     host: '192.168.1.2',
//     pubsubPort: 6021,
//     pipelinePort: 6022,
//   },
//   {
//     serverName: "server-3",
//     host: '192.168.1.3',
//     pubsubPort: 6021,
//     pipelinePort: 6022,
//   },
// ]

deepstream.io-cluster's People

Watchers

 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.