Stop Replica Set MongoDB

后端 未结 3 406
忘了有多久
忘了有多久 2021-01-31 19:25

The command to start a Replica Set in the MongoDB Shell is rs.initiate().

What is the opposite of this command. How do I stop the replica set?

There are commands

3条回答
  •  抹茶落季
    2021-01-31 19:46

    I just have this issue in production. @maganap's (Mar 15) comment saved my bacon!

    Using mongodb 3.2.10, no need to dump the oplog, just do this on the first member:

    use local
    db.system.replset.remove({}) 
    

    Then restart the member. It'll now still have it's oplog, and it's data. Just run:

    rs.initiate()
    rs.reconfig(conf)
    

    Where conf is the new conf. Then on each of the other members, just run the trashing of the replset data above and restart them. When they start they'll join the set.

提交回复
热议问题