2012年3月20日 星期二

Reconfiguring a replica set when members are down - MongoDB

Reconfiguring a replica set when members are down - MongoDB:


  1. Consider doing a backup on a surviving member, both for safety and to bring up more new set members more easily.
  2. Save the current config somewhere so that you can switch back to the old configuration once the down/unreachable members are healed.
    > config = rs.config()
    > printjson(config) # store this somewhere
  3. Remove the down members from the config.members array.
    > // remove the unreachable members of the set. this is just an example, look 
    > // at config to determine which members to keep
    > config.members = [config.members[1], config.members[3], config.members[4]]
  4. Reconfigure the set using the force option on the surviving member.
    > rs.reconfig(config, {force : true})

沒有留言:

張貼留言