1 | 'use strict';
|
2 |
|
3 | const co = require('co');
|
4 |
|
5 | co(function*() {
|
6 | var ReplSet = require('mongodb-topology-manager').ReplSet;
|
7 |
|
8 |
|
9 | var topology = new ReplSet('mongod', [{
|
10 |
|
11 | options: {
|
12 | bind_ip: 'localhost', port: 31000, dbpath: `/data/db/31000`
|
13 | }
|
14 | }, {
|
15 |
|
16 | options: {
|
17 | bind_ip: 'localhost', port: 31001, dbpath: `/data/db/31001`
|
18 | }
|
19 | }, {
|
20 |
|
21 | arbiterOnly: true,
|
22 |
|
23 | options: {
|
24 | bind_ip: 'localhost', port: 31002, dbpath: `/data/db/31002`
|
25 | }
|
26 | }], {
|
27 | replSet: 'rs'
|
28 | });
|
29 |
|
30 | yield topology.start();
|
31 |
|
32 | console.log('done');
|
33 | }).catch(error => {
|
34 | console.error(error);
|
35 | process.exit(-1);
|
36 | });
|