How do I stop Replication within Replica-set in MongoDB

Is there any single command/short process to stop/pause the Replication within a Replica Set (Not Shard enabled) instead following the below long process.

  1. 1. PRIMARY> rs.remove(secondary.host.name:port);
    2. restart secondary without –replSet
    3. do your activity
    4. restart secondary with –replSet, you may also want to use –fastsync
    5. PRIMARY> rs.add(secondary.host.name:port)

I’m just looking for the command to do so similar to MySQL as below.

MASTER> STOP SLAVE; // which stops the replication to slave server
MASTER> START SLAVE; // which resumes it.

———————————————

It seems,  MongoDB do not yet have a similar command to this. In this case I would recommend you use this procedure.

If anyone have any other solutions, feel free to share here.

  • Ask Question