summaryrefslogtreecommitdiffstats
path: root/node_modules/mongoose/tools/repl.js
blob: 8139a512f7b1a8489ee62b7244d0702c1d3c0134 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';

const co = require('co');

co(function*() {
  const ReplSet = require('mongodb-topology-manager').ReplSet;

  // Create new instance
  const topology = new ReplSet('mongod', [{
    // mongod process options
    options: {
      bind_ip: 'localhost', port: 31000, dbpath: `/data/db/31000`
    }
  }, {
    // mongod process options
    options: {
      bind_ip: 'localhost', port: 31001, dbpath: `/data/db/31001`
    }
  }, {
    // Type of node
    arbiterOnly: true,
    // mongod process options
    options: {
      bind_ip: 'localhost', port: 31002, dbpath: `/data/db/31002`
    }
  }], {
    replSet: 'rs'
  });

  yield topology.start();

  console.log('done');
}).catch(error => {
  console.error(error);
  process.exit(-1);
});