MongoDB Documentation, Release 3.0.4 Stop a Replica Set Terminate Running Operations Overview Use --shutdown From the Linux command line, shut down the mongod using the --shutdown option in the following command: mongod --shutdown Use CTRL-C When running the mongod instance in interactive mode (i.e. without --fork ), issue Control-C to perform a clean shutdown. Use kill From the Linux command line, shut down a specific mongod instance using the following command: kill <mongod process ID> Warning: Never use kill -9 (i.e. SIGKILL ) to terminate a mongod instance. Procedure If the mongod is the primary in a replica set , the shutdown process for these mongod instances has the following steps: Force Replica Set Shutdown If there is no up-to-date secondary and you want the primary to shut down, issue the shutdown command with the force argument, as in the following mongo shell operation: db.adminCommand({shutdown : 1, force : true }) To keep checking the secondaries for a specified number of seconds if none are immediately up-to-date, issue shutdown with the timeoutSecs argument. MongoDB will keep checking the secondaries for the specified number of seconds if none are immediately up-to-date. If any of the secondaries catch up within the allotted time, the primary will shut down. If no secondaries catch up, it will not shut down. The following command issues shutdown with timeoutSecs set to 5 : db.adminCommand({shutdown : 1, timeoutSecs : 5}) Alternately you can use the timeoutSecs argument with the db.shutdownServer() method: db.shutdownServer({timeoutSecs : 5}) MongoDB provides two facilitates to terminate running operations: maxTimeMS() and db.killOp() . Use these operations as needed to control the behavior of operations in a MongoDB deployment. Chapter 5. Administration 226 1. Check how up-to-date the secondaries are. 2. If no secondary is within 10 seconds of the primary, mongod will return a message that it will not shut down. You can pass the shutdown command a timeoutSecs argument to wait for a secondary to catch up. 3. If there is a secondary within 10 seconds of the primary, the primary will step down and wait for the secondary to catch up. 4. After 60 seconds or once the secondary has caught up, the primary will shut down.