shutdown
shutdown
- The
shutdown
command cleans up all database resourcesand then terminates the process. You must issuetheshutdown
command against the admin databasein the form:
- { 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:
- { 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:
- { shutdown: 1, timeoutSecs: 60 }
The equivalent mongo
shell helper syntax looks like this:
- db.shutdownServer({timeoutSecs: 60});