db.system.users.find()
{ “_id” : ObjectId(“5032e8386a7fc39e31978c50″), “user” : “admin”, “readOnly” : false, “pwd” : “95ec4261124ba5951720b199908d892b” }
db.runCommand({fsync:1,lock:1})
db.runCommand({fsync:1,lock:1})
{ “errmsg” : “access denied; use admin db”, “ok” : 0 }
use admin
> db.runCommand({fsync:1,lock:1})
{
“info” : “now locked against writes, use db.fsyncUnlock() to unlock”,
“seeAlso” : “http://www.mongodb.org/display/DOCS/fsync+Command“,
“ok” : 1
}
db.currentOp()
> db.currentOp()
{
“inprog” : [ ],
“fsyncLock” : 1,
“info” : “use db.fsyncUnlock() to terminate the fsync write/snapshot lock”
}
use admin
>db.fsyncUnlock()
{ “ok” : 1, “info” : “unlock completed” }
db.$cmd.sys.unlock.findOne() 效果等同
> db.currentOp()
{ “inprog” : [ ] }