- Start mongod on 2 nodes
- login to node1 and call rs.initiate()
- login to node2 and call rs.initiate() and rs.add('<node1>:<port>')
Now rs.status() shows 2 primaries.
It should probably not allow this, or warn before adding the other node, and require a parameter (force: true), and undo the other rs.initiate().
rs:PRIMARY> rs.status()
|
{
|
"set" : "thomas",
|
"date" : ISODate("2012-10-25T22:20:35Z"),
|
"myState" : 1,
|
"members" : [
|
{
|
"_id" : 0,
|
"name" : "capslock.local:27018",
|
"health" : 1,
|
"state" : 1,
|
"stateStr" : "PRIMARY",
|
"uptime" : 50,
|
"optime" : Timestamp(1351203632000, 1),
|
"optimeDate" : ISODate("2012-10-25T22:20:32Z"),
|
"self" : true
|
},
|
{
|
"_id" : 1,
|
"name" : "capslock.local:27017",
|
"health" : 1,
|
"state" : 1,
|
"stateStr" : "PRIMARY",
|
"uptime" : 3,
|
"optime" : Timestamp(1351203598000, 1),
|
"optimeDate" : ISODate("2012-10-25T22:19:58Z"),
|
"lastHeartbeat" : ISODate("2012-10-25T22:20:34Z"),
|
"pingMs" : 0
|
}
|
],
|
"ok" : 1
|
}
|
|