发布于 2015-09-14 15:10:41 | 180 次阅读 | 评论: 0 | 来源: 网络整理
The shutdown command cleans up all database resources and then terminates the process. You must issue the shutdown command against the admin database in the form:
{ shutdown: 1 }
注解
Run the shutdown against the admin database. When using shutdown, the connection must originate from localhost or use an authenticated connection.
If the node you’re trying to shut down is a replica set primary, then the command will succeed only if there exists a secondary node whose oplog data is within 10 seconds of the primary. You can override this protection using the force option:
{ shutdown: 1, force: true }
Alternatively, the shutdown command also supports a timeoutSecs argument which allows you to specify a number of seconds to wait for other members of the replica set to catch up:
{ shutdown: 1, timeoutSecs: 60 }
The equivalent mongo shell helper syntax looks like this:
db.shutdownServer({timeoutSecs: 60});