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/

1 comment:

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

    ReplyDelete