Statement: The article is mainly from the "MongoDB Real Combat" a book, the main want to learn MongoDB knowledge through the book, deepen understanding, so write in their blog, as recorded in the last chapter, there will be a collection of MongoDB database application Java EE Web application.
1, Mongostat
This tool provides a quick view of statistics for a set of running MongoDB instances, using the following:
[[email protected] bin]#./mongostat connected to:127.0.0.1insert Query Update delete getmore command flushes mapped< C1/>vsize res faults locked db idx Miss% qr|qw ar|aw netin netout conn time *0 *0 *0 *0 0 1|0 0 320m 939m 37m 1 zhangsan:0.1% 0 0 |- 0|0 62b 3k 2 21:49:23 *0 *0 *0 *0 0 1|0 0 320m 939m 37m 0 zhangsan:0.0% 0 0|0 0|0 62b 3k 2 21:49:24 *0 *0 *0 *0 0 1|0 0 320m 939m 37m 0 zhangsan:0.0% 0 0|0 0|0 62b 3k 2 21:49:25 *0 *0 *0 *0 0 1|0 0 320m 939m 37m 0 zhangsan:0.0% 0 0|0 0|0 62b 3k 2
Field Description:
- Insert amount per second of insert
- Query volume per second
- Update volume per second
- Delete Amount per second
- Locked Lock ration
- QR|QW Client Query Queue Length (read | write)
- Ar|aw Active Client Volume (read | write)
- Conn Number of connections
- Current time
It refreshes the status value once per second, providing good readability, which allows you to observe the performance of a whole.
2, Db.serverstatusThis command is one of the most commonly used and most basic commands to view the running state of an instance, let's look at its output:
> Db.serverstatus () {"Host": "Localhost.localdomain", "Version": "2.6.6",--Server version "process": "M Ongod "," pid ": Numberlong (29293)," uptime ": 23180,--start time (seconds)" Uptimemillis ": Numberlong (23179942), "Uptimeestimate": 21041, "localtime": Isodate ("2015-01-04t13:53:03.792z"), "asserts": { "Regular": 0, "warning": 0, "MSG": 0, "user": 0, "Rol Lovers ": 0}," backgroundflushing ": {" Flushes ": 386," Total_ms ": 99, "Average_ms": 0.25647668393782386, "Last_ms": 0, "last_finished": Isodate ("201 5-01-04t13:52:44.259z ")}," Connections ": {" current ": 2,--currently active connection volume" availabl E ": 817,--remaining idle connections" totalcreated ": Numberlong (+)}," Cursors ": {" note ":" Deprecated, use server sTatus metrics "," clientcursors_size ": 0," Totalopen ": 0," pinned ": 0, "Totalnotimeout": 0, "timedout": 0}, "dur": {"commits": 29, "JOURNALEDMB": 0, "WRITETODATAFILESMB": 0, "compression": 0, "Commitsinwritelock": 0, "earlycommits": 0, "Timems": {"dt": 30 , "Preplogbuffer": 0, "writetojournal": 0, "write Todatafiles ": 0," Remapprivateview ": 0}}," Extra_info ": { "Note": "Fields vary by platform", "heap_usage_bytes": 62803792, "Page_faults": 3 6}, "GlobalLock": {"TotalTime": Numberlong ("23179943000"), "LockTime": Nu Mberlong (3334379), "Currentqueue": {"Total": 0,--Current Full queue volume "readers": 0,--Read request queue volume "Writers": 0--write Request queue volume}, "Activeclients": {"to Tal ": 0,--Current Total Client connection volume" readers ": 0,--Client Read request Volume" writers ": 0--Client Write Request volume }}, "Indexcounters": {"accesses":,--index Access "hits":,--index Hits "Misses": 0,--Index deviation two "resets": 0, "missratio": 0--index deviation rate (not hit)}, "Locks": {".": {"Timelockedmicros": {"R": Numberlong (954466), "W": Numberlong (3334379)}, "Timeacquiringmicros": {"R": Numberlong (5652043), "W" : Numberlong (133798) }}, "admin": {"Timelockedmicros": { "R": Numberlong (255071), "W": Numberlong (0) }, "Timeacquiringmicros": {"R": Numberlong (67318), "W": Numberlong (0)}}, "local": { "Timelockedmicros": {"R": Numberlong (82150), "W" : Numberlong}, "Timeacquiringmicros": { "R": Numberlong (18964), "W": Numberlong (1)}}, "Zhangsan": {"Timelockedmicros": {"R": Numberlong (8788), "W": Numberlong (1673999)}, "Timeacquiringmicros": { "R": Numberlong (1409), "W": Numberlong (55) }}, "temp": {"Timelockedmicros": { "R": Numberlong (340424), "W": Numberlong (2765621)}, "Timeacquiringmicros": {"R": Numberlong (111659), "W": Numberlong (6212)}}, "Test": {"T Imelockedmicros ": {" R ": Numberlong (602182)," W ": Numberl Ong (437948)}, "Timeacquiringmicros": {"R" : Numberlong (73084), "W": Numberlong}}}, "Network": { "Bytesin": 66494,--The amount of data sent to this server (in bytes) "Bytesout": 865147,--The amount of data emitted by this server in bytes
"Numrequests": The amount of 851--sent to this server}, "Opcounters": {"Insert": 9,--The amount of insert operation "Query": 1928,--The amount of the query operation "Update": 8,--The amount of the update operation "Delete": 2, "Getm Ore ": 0," command ": 812--the amount of other operations}," Opcountersrepl ": {" Insert ": 0, "Query": 0, "Update": 0, "delete": 0, "Getmore": 0, "Command": 0}, "Recordstats": {"accessesnotinmemory": 0, "Pagefaultexc Eptionsthrown ": 0," admin ": {" accessesnotinmemory ": 0," p Agefaultexceptionsthrown ": 0}," local ": {" accessesnotinmemory ": 0, "Pagefaultexceptionsthrown": 0}, "temp": { "Accessesnotinmemory" : 0, "Pagefaultexceptionsthrown": 0}, "test": { "Accessesnotinmemory": 0, "Pagefaultexceptionsthrown": 0}, " Zhangsan ": {" accessesnotinmemory ": 0," Pagefaultexceptionsthrown ": 0 }}, "writebacksqueued": false, "mem": {"bits": 64-bit system,-- "Resident": Panax Notoginseng,--occupy the physical Memory "virtual": 939,--Virtual Memory "supported": TRUE,--support extended RAM "Mapped": "Mappedwithjournal": 640}, "metrics": {"cursor": { "TimedOut": Numberlong (0), "open": {"Noti Meout ": Numberlong (0)," pinned ": Numberlong (0)," Total ": Numberlong (0) }}, "document": {"deleted": Numberlong (1), "Inserted": Numberlong (9), "returned": Numberlong (428), "upd Ated ": Numberlong (8)}," GetLastError ": {" Wtime ": { "num": 0, "Totalmillis": 0}, "Wtimeouts": Numberlong (0)}, "operation": {"Fastmod": Numbe Rlong (1), "Idhack": Numberlong (0), "Scanandorder": Numberlong (0) }, "Queryexecutor": {"scanned": Numberlong (2), "scan Nedobjects ": Numberlong (2)}," record ": {" Moves ": Numberlong (0) }, "Repl": {"Apply": {"Batches": { "num": 0, "Totalmillis": 0}, "Ops": Numberlong (0)}, "buffer": { "Count": Numberlong (0), "maxsizebytes": 268435456, "Sizebytes": Numberlong (0)}, "network": { "bytes": Numberlong (0), "Getmores": { "num": 0, "Totalmillis": 0}, "Ops": Numberlong (0), "readerscreated": Numberlong (0) }, "Preload": {"docs": {"num": 0, "Totalmillis": 0}, "Indexes": { "num": 0, "Totalmillis": 0 }}}, "Storage": {"freelist ": {" search ": {" bucketexhausted ": Numberlong (0) , "Requests": Numberlong (399), "scanned": Numberlong (731)}}, "TTL": { "Deleteddocuments": Numberlong (0), "passes": Numberlong (386)} }, "OK": 1}>
3, Db.statsdb.stats View the database status information, use the following example:
> Db.stats () { "db": "Test", "Collections":,--Collection Quantity "Objects":,--Number of objects "Avgobjsize" : 72.42105263157895,--Object Average size "datasize": 11008,--data size "storagesize": 131072,--Data size (with pre-allocated space) " Numextents ":,--Number of events " Indexes ":,--index number " Indexsize ": 163520,--Index file size " fileSize ": 67108864,--File size c10/> "Nssizemb": +, "datafileversion": { "Major": 4, "minor": 5 }, "Extentfreelist": { c16/> "num": 1, "totalsize": 131072 },
With this tool, you can view the basic information of the current database.
4. Third-party tools
MongoDB from the advent of many open-source enthusiasts and the attention of the team, in the common monitoring framework such as cacti, Nagios, Zabbix and other based on the expansion of MongoDB monitoring is very convenient.
---------------------------------MongoDB Series Article update--------------------------------------------------------------------------- --------------
The first part of the basic chapter into MongoDB
The first part of the basic chapter II install MongoDB
Part I basic chapter III MONGODB architecture
The first part of the basic chapter fourth MongoDB Quick Start
The first part of the basic chapter Fourth MongoDB query
Part Two application chapter Fifth MongoDB advanced query
Part Two application chapter sixth MongoDB Gridfs
Part Two application chapter seventh MongoDB MapReduce
Part III Management chapter eighth MONGODB service Management
Part III Management Chapter Nineth the MongoDB Shell system command, user command
Part III Management Chapter Nineth of the MongoDB shell eval, process
Part IV Performance Chapter Tenth MongoDB index
Part IV Performance Chapter 11th MongoDB performance Monitoring