Tuesday, April 9, 2019

Force Secondary to Primary

Convert secondary Node to primary if maximum of node down in a replica set

 

1. Save replica set config in a var

 

cfg = rs.conf()
printjson(cfg)

 

2. Remove the unreachable members

 

cfg.members = [cfg.members[0] , cfg.members[4] , cfg.members[7]]

 

3. Reconfig

 

rs.reconfig(cfg, {force : true}) 

 

 

Refer: https://docs.mongodb.com/manual/tutorial/reconfigure-replica-set-with-unavailable-members/

2 comments:

  1. ExactInside Exam MB-900 dumps Study Guide imparts you the best knowledge on each and every aspect of the Microsoft certification exam.

    ReplyDelete
  2. Thanks and I have a dandy present: What House Renovations Need Council Approval house renovation business

    ReplyDelete