Dbstats command
The Dbstats command can return storage information for a specified database, by default displaying storage information in bytes, and you can add a scale parameter, such as scale:1024 for kilobytes display. The time to return information is determined by the size of the specified database.
> Db.runcommand ({dbstats:1,scale:1}) {"DB": "Test", "collections":, "Objects": 161, "avgobjsize": 61.39130434782 6086, "datasize": 9884, "storagesize": 245760, "numextents": "Indexes": "Indexsize": 547792, "fileSize": 201326592 , "NSSIZEMB": +, "datafileversion": {"Major": 4, "minor": 5}, "OK": 1}
> Db.runcommand ({dbstats:1,scale:1024}) {"DB": "Test", "collections":, "Objects": 161, "avgobjsize": 61.39130434 7826086, "DataSize": 9, "storagesize": +, "numextents": "Indexes": "Indexsize": 534, "fileSize": 196608, "Nssizem" B ": +," datafileversion ": {" Major ": 4," minor ": 5}," OK ": 1}
You can also use Db.stats () or db.stats (1024)
> Db.stats (1024x768) {"DB": "Test", "Collections": "Objects": 161, "avgobjsize": 61.391304347826086, "datasize": 9, "St Oragesize ":" numextents ":" Indexes ":" Indexsize ": 534," fileSize ": 196608," nssizemb ": +," datafileversion " : {"Major": 4, "minor": 5}, "OK": 1}
DB name of the current database, if you want to view the storage information for the specified database, you can use the Using test
Collections the number of collections contained in the current database
Objects the number of objects (such as documents) contained in all collections in the database
Avgobjsize the average size of each document, expressed in bytes, which equals datasize divided by objects
Dataszie the size of the data held by the current database, including the padding factor, the scale affects this value, and when the size of the document shrinks, the Dataszie does not decrease, but if you delete the document, the DataSize value decreases
Storagesize The amount of storage allocated to the database used to store all the collections in the bytes calculation, the scale affects this value, and the value of storagesize does not decrease when the document is deleted or shrunk
numextents The number of extent contained in all collections in the database
Indexes the number of indexes contained in all collections in the database
Indexsize the size of all indexes created on this database, expressed as bytes, scale affects this value
The size of the data file for the FileSize database, in bytes, which includes pre-allocated space and padding factor, which only reflects the size of the data file and does not reflect the size of the domain name space
This article is from the Linux SA John blog, so be sure to keep this source http://john88wang.blog.51cto.com/2165294/1564595
MongoDB monitoring four Dbstats and Collstats and Replsetgetstatus