Google Groups

Force set ReplicaSet node primary


and_hom May 30, 2012 6:51 AM
Posted in group: mongodb-user
Hello!

I'm testing Mongodb cluster. I have 3 shards with 3 replica-set-nodes
in each shard. To check reliability I killed 2 of 3 replicas in each
shard using kill -9 command.
So now I have a replica set with one alive secondary node.

SECONDARY> rs.status();
{
        "set" : "shard1",
        "date" : ISODate("2012-05-30T13:47:23Z"),
        "myState" : 2,
        "members" : [
                {
                        "_id" : 0,
                        "name" : "localhost:1110",
                        "health" : 0,
                        "state" : 8,
                        "stateStr" : "(not reachable/healthy)",
                        ....................................
                        "errmsg" : "socket exception"
                },
                {
                        "_id" : 1,
                        "name" : "localhost:1111",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        ....................................

                },
                {
                        "_id" : 2,
                        "name" : "localhost:1112",
                        "health" : 0,
                        "state" : 8,
                        "stateStr" : "(not reachable/healthy)",
                        ....................................
                        "errmsg" : "socket exception"
                }
        ],
        "ok" : 1
}


Is there any way to set node _id=1 primary? How to configure replica
set to provide reliability? Is master node death destroys replica set?

Thanks!