4.3.1 • Published 6 years ago

prettygoat-cluster v4.3.1

Weekly downloads
125
License
-
Repository
-
Last release
6 years ago

Prettygoat-cluster

Workload distribution and failover for prettygoat based on ringpop.

Installation

$ npm install prettygoat-cluster

Usage

Register the module with prettygoat

import {ClusteredEngine} from "prettygoat-cluster";

let engine = new ClusteredEngine();
//Register projections...
engine.run();

This will run the engine with the default cluster configuration (one node). If you need to run different instances on the same machine just drop this configuration:

container.bind<IClusterConfig>("IClusterConfig").toConstantValue({
    nodes: ["127.0.0.1:4000", "127.0.0.1:4001"],
    port: 4000,
    host: "127.0.0.1",
    forks: 2
});

Load balancing

To load balance HTTP and Websockets among the cluster, use loadbalancer.

Example configuration:

{
  "sourcePort": 8000,
  "stickiness": false,
  "targets": [
    {
      "host": "127.0.0.1",
      "port": 3000
    },
    {
      "host": "127.0.0.1",
      "port": 3001
    }
  ]
}

Socket.io clustering

In order to correctly send notifications between all the instances of socket.io server, you need to provide a Redis client.

const Redis = require("ioredis");

container.bind("RedisClient").toConstantValue(new Redis.Cluster([
  {
    port: 6380,
    host: '127.0.0.1'
  },
  {
    port: 6381,
    host: '127.0.0.1'
  }
]));

License

Copyright 2016 Tierra SpA

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

4.3.1

6 years ago

4.3.0

6 years ago

4.2.0

6 years ago

3.2.6

6 years ago

3.2.5

6 years ago

4.1.1

6 years ago

3.2.4

6 years ago

4.1.0

6 years ago

4.0.0

6 years ago

3.2.3

6 years ago

3.2.2

6 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.5

6 years ago

3.1.4

6 years ago

3.1.3

6 years ago

3.1.2

6 years ago

3.1.1

7 years ago

3.1.0

7 years ago

3.0.0

7 years ago

2.0.0

7 years ago

2.0.0-2

7 years ago

2.0.0-1

7 years ago

2.0.0-0

7 years ago

1.0.0-7

7 years ago

1.0.0-6

7 years ago

1.0.0-5

7 years ago

1.0.0-rc4

7 years ago

1.0.0-rc3

7 years ago

1.0.0-rc2

7 years ago

1.0.0-rc1

7 years ago