发布于 2015-09-14 15:02:12 | 159 次阅读 | 评论: 0 | 来源: 网络整理
This document provides a quick overview and example of the serverStatus command. The helper db.serverStatus() in the mongo shell provides access to this output. For full documentation of the content of this output, see 服务器状态参考.
注解
The fields included in this output vary slightly depending on the version of MongoDB, underlying operating system platform, and the kind of node, including mongos, mongod or replica set member.
The “Instance Information” section displays information regarding the specific mongod and mongos and its state.
{
"host" : "<hostname>",
"version" : "<version>",
"process" : "<mongod|mongos>",
"pid" : <num>,
"uptime" : <num>,
"uptimeMillis" : <num>,
"uptimeEstimate" : <num>,
"localTime" : ISODate(""),
The “locks” section reports data that reflect the state and use of both global (i.e. .) and database specific locks:
"locks" : {
"." : {
"timeLockedMicros" : {
"R" : <num>,
"W" : <num>
},
"timeAcquiringMicros" : {
"R" : <num>,
"W" : <num>
}
},
"admin" : {
"timeLockedMicros" : {
"r" : <num>,
"w" : <num>
},
"timeAcquiringMicros" : {
"r" : <num>,
"w" : <num>
}
},
"local" : {
"timeLockedMicros" : {
"r" : <num>,
"w" : <num>
},
"timeAcquiringMicros" : {
"r" : <num>,
"w" : <num>
}
},
"<database>" : {
"timeLockedMicros" : {
"r" : <num>,
"w" : <num>
},
"timeAcquiringMicros" : {
"r" : <num>,
"w" : <num>
}
}
},
The “globalLock” field reports on MongoDB’s global system lock. In most cases the locks document provides more fine grained data that reflects lock use:
"globalLock" : {
"totalTime" : <num>,
"lockTime" : <num>,
"currentQueue" : {
"total" : <num>,
"readers" : <num>,
"writers" : <num>
},
"activeClients" : {
"total" : <num>,
"readers" : <num>,
"writers" : <num>
}
},
The “mem” field reports on MongoDB’s current memory use:
"mem" : {
"bits" : <num>,
"resident" : <num>,
"virtual" : <num>,
"supported" : <boolean>,
"mapped" : <num>,
"mappedWithJournal" : <num>
},
The “connections” field reports on MongoDB’s current memory use by the MongoDB process:
"connections" : {
"current" : <num>,
"available" : <num>
},
The fields in the “extra_info” document provide platform specific information. The following example block is from a Linux-based system:
"extra_info" : {
"note" : "fields vary by platform",
"heap_usage_bytes" : <num>,
"page_faults" : <num>
},
The “indexCounters” document reports on index use:
"indexCounters" : {
"btree" : {
"accesses" : <num>,
"hits" : <num>,
"misses" : <num>,
"resets" : <num>,
"missRatio" : <num>
}
},
The “backgroundFlushing” document reports on the process MongoDB uses to write data to disk:
"backgroundFlushing" : {
"flushes" : <num>,
"total_ms" : <num>,
"average_ms" : <num>,
"last_ms" : <num>,
"last_finished" : ISODate("")
},
The “cursors” document reports on current cursor use and state:
"cursors" : {
"totalOpen" : <num>,
"clientCursors_size" : <num>,
"timedOut" : <num>
},
The “network” document reports on network use and state:
"network" : {
"bytesIn" : <num>,
"bytesOut" : <num>,
"numRequests" : <num>
},
The “repl” document reports on the state of replication and the replica set. This document only appears for replica sets.
"repl" : {
"setName" : "<string>",
"ismaster" : <boolean>,
"secondary" : <boolean>,
"hosts" : [
<hostname>,
<hostname>,
<hostname>
],
"primary" : <hostname>,
"me" : <hostname>
},
The “opcountersRepl” document reports the number of replicated operations:
"opcountersRepl" : {
"insert" : <num>,
"query" : <num>,
"update" : <num>,
"delete" : <num>,
"getmore" : <num>,
"command" : <num>
},
The “replNetworkQueue” document holds information regarding the queue that secondaries use to poll data from other members of their set:
"replNetworkQueue" : {
"waitTimeMs" : <num>,
"numElems" : <num>,
"numBytes" : <num>
},
The “opcounters” document reports the number of operations this MongoDB instance has processed:
"opcounters" : {
"insert" : <num>,
"query" : <num>,
"update" : <num>,
"delete" : <num>,
"getmore" : <num>,
"command" : <num>
},
The “asserts” document reports the number of assertions or errors produced by the server:
"asserts" : {
"regular" : <num>,
"warning" : <num>,
"msg" : <num>,
"user" : <num>,
"rollovers" : <num>
},
The “writeBacksQueued” document reports the number of writebacks:
"writeBacksQueued" : <num>,
The “dur” document reports on data that reflect this mongod instance’s journaling-related operations and performance during a journal group commit interval:
"dur" : {
"commits" : <num>,
"journaledMB" : <num>,
"writeToDataFilesMB" : <num>,
"compression" : <num>,
"commitsInWriteLock" : <num>,
"earlyCommits" : <num>,
"timeMs" : {
"dt" : <num>,
"prepLogBuffer" : <num>,
"writeToJournal" : <num>,
"writeToDataFiles" : <num>,
"remapPrivateView" : <num>
}
},
The “recordStats” document reports data on MongoDB’s ability to predict page faults and yield write operations when required data isn’t in memory:
"recordStats" : {
"accessesNotInMemory" : <num>,
"pageFaultExceptionsThrown" : <num>,
"local" : {
"accessesNotInMemory" : <num>,
"pageFaultExceptionsThrown" : <num>
},
"<database>" : {
"accessesNotInMemory" : <num>,
"pageFaultExceptionsThrown" : <num>
}
},
The final ok field holds the return status for the serverStatus command:
"ok" : 1
}