/node_modules/mongoose/tools/repl.js

https://bitbucket.org/coleman333/smartsite · JavaScript · 36 lines · 26 code · 5 blank · 5 comment · 0 complexity · 656071ffb1e36e54c9b6666a0542d0e1 MD5 · raw file

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