dbStats

rs_main:PRIMARY> db.runCommand({ dbStats: 1, scale: 1 })

{

"db" : "test",

"collections" : 4,

"objects" : 12,

"avgObjSize" : 56.333333333333336,

"dataSize" : 676,

"storageSize" : 20480,

"numExtents" : 4,

"indexes" : 3,

"indexSize" : 24528,

"fileSize" : 201326592,

"nsSizeMB" : 16,

"dataFileVersion" : {

"major" : 4,

"minor" : 5

},

"ok" : 1

}

dbStats

Definition

The dbStats command returns storage statistics for a given database. The command takes the following syntax:

{ dbStats: 1, scale: 1 }

The values of the options above do not affect the output of the command. The scale option allows you to specify how to scale byte values. For example, a scale value of 1024 will display the results in kilobytes rather than in bytes:

{ dbStats: 1, scale: 1024 }

NOTE

Because scaling rounds values to whole numbers, scaling may return unlikely or unexpected results.

The time required to run the command depends on the total size of the database. Because the command must touch all data files, the command may take several seconds to run.

In the mongo shell, the db.stats() function provides a wrapper around dbStats.

Output

dbStats.db

Contains the name of the database.

dbStats.collections

Contains a count of the number of collections in that database.

dbStats.objects

Contains a count of the number of objects (i.e. documents) in the database across all collections.

dbStats.avgObjSize

The average size of each document in bytes. This is the dataSize divided by the number of documents.

dbStats.dataSize

The total size in bytes of the data held in this database including the padding factor. The scale argument affects this value. The dataSize will not decrease when documents shrink, but will decrease when you remove documents.

dbStats.storageSize

The total amount of space in bytes allocated to collections in this database for document storage. The scale argument affects this value. The storageSize does not decrease as you remove or shrink documents.

dbStats.numExtents

Contains a count of the number of extents in the database across all collections.

dbStats.indexes

Contains a count of the total number of indexes across all collections in the database.

dbStats.indexSize

The total size in bytes of all indexes created on this database. The scale arguments affects this value.

dbStats.fileSize

The total size in bytes of the data files that hold the database. This value includes preallocated space and the padding factor. The value of fileSize only reflects the size of the data files for the database and not the namespace file.

The scale argument affects this value.

dbStats.nsSizeMB

The total size of the namespace files (i.e. that end with .ns) for this database. You cannot change the size of the namespace file after creating a database, but you can change the default size for all new namespace files with the nsSize runtime option.

storage.nsSize

Type: integer

Default: 16

Specifies the default size for namespace files, which are files that end in .ns. Each collection and index counts as a namespace.

Use this setting to control size for newly created namespace files. This option has no impact on existing files. The maximum size for a namespace file is 2047 megabytes. The default value of 16 megabytes provides for approximately 24,000 namespaces.

The storage.nsSize option is available only for mongod.

SEE ALSO

The nsSize option, and Maximum Namespace File Size

dbStats.dataFileVersion

New in version 2.4.

Document that contains information about the on-disk format of the data files for the database.

dbStats.dataFileVersion.major

New in version 2.4.

The major version number for the on-disk format of the data files for the database.

dbStats.dataFileVersion.minor

New in version 2.4.

The minor version number for the on-disk format of the data files for the database.

时间: 2025-01-19 20:32:52

dbStats的相关文章

MongoDB监控四 dbStats和collStats和replSetGetStatus

dbStats命令 dbStats命令可以返回指定数据库的存储信息,默认是以bytes为单位显示存储信息,可以增加一个scale参数,如scale : 1024表示kilobytes显示.返回信息的时间由指定数据库的大小决定. > db.runCommand({dbStats : 1,scale : 1}) { "db" : "test", "collections" : 28, "objects" : 161, &qu

Mongodb监控命令

Mongodb监控命令 一.监控工具 1.mongostat工具 默认为显示每秒的统计信息 # mongostat -uroot -ppassword --authenticationDatabase admin -h192.168.x.xx  --rowcount 10 1 connected to: 192.168.x.xx insert  query update delete getmore command flushes mapped  vsize    res faults  loc

驱动11.网卡驱动程序

1 网络传输的简介 (1)接收过程,如上图,网络上的数据包到达网卡后,网卡产生中断,然后设备驱动层收到中断后,开始进行网络包的接收,接收完之后调用一个netif_rx函数交给网络协议层(层次结构上图一),然后就是一层一层的网上传到用户空间了. (2)发送过程,从用户空间过来的数据包,经过层层穿越之后,到达网络协议层,然后调用一个dev_queue_xmit()函数之后就不管了,剩下的交给驱动层经过处理后,使用函数hard_start_xmit()函数发送,然后硬件上网卡开始发送数据包了. 2 d

MongoDB.WebIDE:升级版的Mongodb管理工具

很早以前收藏了一片文章:<强大的MongoDB数据库管理工具>.最近刚好要做一些MongoDB方面的工作,于是翻出来温习了一下,用起来也确实挺方便.不过在使用过程中出现了一些个问题,加上更喜欢MongoUVE的操作习惯,于是决定“自己动手,丰衣足食”,写一个升级版的工具. 一.升级的基础内容 原版是用的WebForm开发的,新版打算升级到MVC 前端框架使用bootstrap Mongodb的驱动程序改为使用官方版的驱动程序 原版查询数据时使用的是解析sql语句的方式,新版打算采用javasc

mongodb常见管理命令

----------1.复制数据库 wind:PRIMARY> show dbs; jinri 0.078GB local 1.078GB test 0.078GB wind 0.078GB wind:PRIMARY> use admin; switched to db admin db.runCommand( {copydb : 1, fromhost : "localhost", fromdb : "wind", todb : "snow&

MySQL &#183; myrocks &#183; myrocks监控信息

MySQL · myrocks · myrocks监控信息 rocksdb本身提供了丰富的监控信息,myrocks通过information_schema下的表和show命令等将这些信息展示出来,下面主要以示例的形式来简单介绍下 先创建测试表 CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT ,PRIMARY KEY(pk) comment 'cf_1', key idx2(b) comment 'cf_2') engine=roc

MongoDB用户及权限管理(一):角色说明

mongodb安装完后默认是不开启auth模块的,普通用户和超级管理员均不通过认证就可操作.当然裸奔有风险,安全起见还是开启auth模块. 首先需要了解下面几点: 1.mongodb是没有默认管理员账号,所以要先添加管理员账号,然后开启权限认证. 2.切换到admin数据库,添加的账号才是管理员账号. 3.用户只能在用户所在数据库登录,包括管理员账号. 4.管理员可以管理所有数据库,但是不能直接管理其他数据库,要先在admin数据库认证后才可以.这一点比较怪. 1.用户权限角色说明 1.1  D

嵌入式Linux驱动学习之路(二十六)DM9000C网卡驱动程序

基于DM9000C的原厂代码修改dm9000c的驱动程序. 首先确认内存的基地址 iobase. 确定中断号码. 打开模块的初始化函数定义. 配置内存控制器的相应时序(结合DM9000C.C的手册). 程序代码: /* dm9ks.c: Version 2.08 2007/02/12 A Davicom DM9000/DM9010 ISA NIC fast Ethernet driver for Linux. This program is free software; you can redi

SQLiteDatabase 源码

/** * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://