: 0,
"user" : 1,
"rollovers" : 0
},
"writeBacksQueued" : false,
"ok" : 1
}
>
3.db.stats()
> db.stats()
{
"db" : "test",
"collections" : 4,
"objects" : 28,
"avgObjSize" : 43.142857142857146,
"dataSize" : 1208,
"storageSize" : 10496,
"numExtents" : 4,
"indexes" : 2,
"indexSize" : 16384,
"fileSize" : 50331648,
"ok" : 1
}
>
4.mongosniff
此工具可以从底层监控到底有哪些命令发送给了MongoDB去执行,从中就可以进行分析;
[root@Mongodb ~]# /Apps/mongo/bin/mongosniff --source NET lo
sniffing... 27017
127.0.0.1:42168 -->> 127.0.0.1:27017 test.things 45 bytes id:8cee6609 2364433929
query: {} ntoreturn: 3 ntoskip: 2
127.0.0.1:27017 <<-- 127.0.0.1:42168 Mx疃 n# 168 bytes id:80aca2a2 2158797474 - 2364433929
reply n:3 cursorId: 2553044974605072461
{ _id: ObjectId('51adf11685702b41681359ae'), x: 4.0, j: 1.0 }
127.0.0.1:42168 -->> 127.0.0.1:27017 admin.$cmd 80 bytes id:8cee660a 2364433930
query: { replSetGetStatus: 1, forShell: 1 } ntoreturn: 1 ntoskip: 0
127.0.0.1:27017 <<-- 127.0.0.1:42168 92 bytes id:80aca2a3 2158797475 - 2364433930
reply n:1 cursorId: 0
{ errmsg: "not running with --replSet", ok: 0.0 }
^[[A127.0.0.1:42168 -->> 127.0.0.1:27017 test.things 45 bytes id:8cee660b 2364433931
query: {} ntoreturn: 3 ntoskip: 2
127.0.0.1:27017 <<-- 127.0.0.1:42168 w疃x\DV 168 bytes id:80aca2a4 2158797476 - 2364433931
reply n:3 cursorId: 6216195059213048439
{ _id: ObjectId('51adf11685702b41681359ae'), x: 4.0, j: 1.0 }
127.0.0.1:42168 -->> 127.0.0.1:27017 admin.$cmd 80 bytes id:8cee660c 2364433932
query: { replSetGetStatus: 1, forShell: 1 } ntoreturn: 1 ntoskip: 0
127.0.0.1:27017 <<-- 127.0.0.1:42168 92 bytes id:80aca2a5 2158797477 - 2364433932
reply n:1 cursorId: 0
{ errmsg: "not running with --replSet", ok: 0.0 }
^[[ 1;2c127.0.0.1:42168 -->> 127.0.0.1:27017 test.$cmd 82 bytes id:8cee660d 2364433933
query: { count: "c1", query: {}, fields: {} } ntoreturn: -1 ntoskip: 0
127.0.0.1:27017 <<-- 127.0.0.1:42168 64 bytes id:80aca2a6 2158797478 - 2364433933
reply n:1 cursorId: 0
{ n: 1.0, ok: 1.0 }