2010-06-10 18:02:17 -04:00
|
|
|
// test helpers
|
|
|
|
|
// load("test_framework.js")
|
|
|
|
|
|
2010-06-16 15:44:01 -04:00
|
|
|
DB.prototype.isMaster = function() {
|
|
|
|
|
return this.runCommand("isMaster");
|
|
|
|
|
}
|
|
|
|
|
DB.prototype.ismaster = function () { return this.isMaster().ismaster; }
|
|
|
|
|
|
2010-06-10 18:02:17 -04:00
|
|
|
function rs_mongod() {
|
2010-06-14 22:13:57 -04:00
|
|
|
/* run mongod for a replica set member. wipes data dir! */
|
2010-06-10 18:02:17 -04:00
|
|
|
var port = __nextPort++;
|
2010-06-14 22:13:57 -04:00
|
|
|
var not_me = (port == 27000 ? port + 1 : port - 1);
|
2010-06-10 18:02:17 -04:00
|
|
|
var f = startMongodEmpty;
|
|
|
|
|
var dir = "" + port; // e.g., data/db/27000
|
|
|
|
|
var conn = f.apply(null, [
|
|
|
|
|
{
|
|
|
|
|
port: port,
|
|
|
|
|
dbpath: "/data/db/" + dir,
|
|
|
|
|
noprealloc: "",
|
|
|
|
|
smallfiles: "",
|
|
|
|
|
oplogSize: "2",
|
|
|
|
|
//nohttpinterface: ""
|
2010-06-14 22:13:57 -04:00
|
|
|
rest: "", // --rest is best for replica set administration
|
2010-06-11 00:16:34 -04:00
|
|
|
replSet: "asdf/" + hostname() + ":" + not_me
|
2010-06-10 18:02:17 -04:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
conn.name = "localhost:" + port;
|
|
|
|
|
return conn;
|
|
|
|
|
}
|