shutdown

  • shutdown
  • The shutdown command cleans up all database resourcesand then terminates the process. You must issuethe shutdown command against the admin databasein the form:
  1. { shutdown: 1 }

Note

Run the shutdown against the admin database. Whenusing shutdown, the connection must originate fromlocalhost or use an authenticated connection.

If the node you’re trying to shut down is a replica setprimary, then the command will succeed only if there exists a secondary nodewhose oplog data is within 10 seconds of the primary. You can override this protectionusing the force option:

  1. { shutdown: 1, force: true }

Alternatively, the shutdown command also supports a timeoutSecs argumentwhich allows you to specify a number of seconds to wait for othermembers of the replica set to catch up:

  1. { shutdown: 1, timeoutSecs: 60 }

The equivalent mongo shell helper syntax looks like this:

  1. db.shutdownServer({timeoutSecs: 60});