Reputation: 1891
I am using virtualbox to create Mongodb replication set. I have initiated the primary on first server. However, when I restart virtualbox the primary become the secondary. Please help me reset replication Set and how to return to the primary
Upvotes: 0
Views: 552
Reputation: 2354
When you restart your virtual box then there is an election which takes place and mongo selects one of your servers to become primary. If at all you want your selected mongod to be made primary all the time then there are various things you could do.
Lower the priority of the secondary
http://docs.mongodb.org/manual/tutorial/adjust-replica-set-member-priority/
http://docs.mongodb.org/manual/tutorial/configure-secondary-only-replica-set-member/
Make you secondary hidden (You might have severe consequences in auto failovers)
http://docs.mongodb.org/manual/core/replica-set-hidden-member/
For more replica set configuring options look here
http://docs.mongodb.org/manual/reference/replica-configuration/
You could even use the votes parameter to suffice your need.
Upvotes: 2