mongodb中serverStatus()返回参数理解

来源:互联网 发布:springmvc json 编辑:程序博客网 时间:2024/05/21 17:58
本文是个人的理解,由于自身能力有限,也许会存在误解,欢迎留言指正,本人一定虚心请教,谢谢
serverStatus的输出取决于MongoDB的版本,操作系统,存储引擎,和节点类型(mongosmongod、副本集成员)。
如果要显示某个属性就设置值为1,否则设置为0
比如下面的命令就不会显示replmetricslocks的信息db.runCommand( { serverStatus: 1, repl: 0, metrics: 0, locks: 0 } )
下面的命令就在输出中包括rangeDeleterrepl的所有信息db.runCommand( { serverStatus: 1, rangeDeleter: 1, repl: 1 } )
mongos> db.serverStatus()db.serverStatus(){        "host" : "gs2:10",#系统的主机名        "version" : "3.4.7",#mongodb版本        "process" : "mongos",#当前mongodb的进程,可能的是:mongos或者mongod.        "pid" : NumberLong(17124),#进程ID        "uptime" : 1365907,#当前mongodb进程已经活跃的秒数        "uptimeMillis" : NumberLong(1365907544),#当前mongodb进程已经活跃的毫秒数        "uptimeEstimate" : NumberLong(1365907),#mongodb内部系统时间计算的正常工作时间,以秒为单位        "localTime" : ISODate("2017-10-25T07:28:39.604Z"),#系统的当前时间    #asserts返回的是一个文档,报告自MongoDB进程开始后所产生的assertions数量。而assert errors通常是不常见的,    # 如果有非零值,你应该检查日志文件来查看更多信息。        "asserts" : {                "regular" : 0,#mongodb进程启动后产生的常规ssertions数量,查看日志文件以获取更过信息                "warning" : 0,#mongodb进程启动后产生的警告数量                "msg" : 0,#消息数目                "user" : 90612,                "rollovers" : 0        },    #connections返回的是文档连接状态。使用这些值可以评估当前负载和服务器的容量需求。        "connections" : {                "current" : 13,#从客户到数据库服务器的连接,包括当前会话                "available" : 819187,#可用的连接数                "totalCreated" : 884#创建过的所有连接,包括已经关闭过了的        },    #extra_info返回的是系统的其他信息        "extra_info" : {                "note" : "fields vary by platform",                "page_faults" : 185#错误页面的总数        },        "network" : {#网络                "bytesIn" : NumberLong("2905159959"),#数据库网络通信所收到的字节数                "bytesOut" : NumberLong("3836423563"),#数据库网络通信所发送的字节数                "physicalBytesIn" : NumberLong("2905159959"),                "physicalBytesOut" : NumberLong("3702692307"),                "numRequests" : NumberLong(2350394)#服务器收到的不同的请求数目        },        "opcounters" : {#上一次启动后的数据库操作情况                "insert" : 14846519,# mongod 开始后的插入次数                "query" : 170,#查询次数                "update" : 0,#更新次数                "delete" : 0,#删除次数                "getmore" : 159,#getmore的次数                "command" : 1174856#发布到数据库的总命令数        },        "sharding" : {                "configsvrConnectionString" : "cfgSet/11.18.9.12:111,1.18.9.15:110,17.10.9.14:11",                "lastSeenConfigServerOpTime" : {                        "ts" : Timestamp(1508916518, 1),                        "t" : NumberLong(3)                }        },        "tcmalloc" : {                "generic" : {                        "current_allocated_bytes" : 2933168,                        "heap_size" : 90456064                },                "tcmalloc" : {                        "pageheap_free_bytes" : 77418496,                        "pageheap_unmapped_bytes" : 344064,                        "max_total_thread_cache_bytes" : 1024458752,                        "current_total_thread_cache_bytes" : 2205720,                        "total_free_bytes" : 9760336,                        "central_cache_free_bytes" : 2272152,                        "transfer_cache_free_bytes" : 5282464,                        "thread_cache_free_bytes" : 2205720,                        "aggressive_memory_decommit" : 0,                        "formattedString" : "-----------                                            MALLOC:        2933168 (    2.8 MiB) Bytes in use by application                                            MALLOC: +     77418496 (   73.8 MiB) Bytes in page heap freelist                                            MALLOC: +      2272152 (    2.2 MiB) Bytes in central cache freelist                                            MALLOC: +      5282464 (    5.0 MiB) Bytes in transfer cache freelist                                            MALLOC: +      2205720 (    2.1 MiB) Bytes in thread cache freelists                                            MALLOC: +      1335488 (    1.3 MiB) Bytes in malloc metadata                                            MALLOC:   ------------                                            MALLOC: =     91447488 (   87.2 MiB) Actual memory used (physical + swap)                                            MALLOC: +       344064 (    0.3 MiB) Bytes released to OS (aka unmapped)                                            MALLOC:   ------------"                                            MALLOC: =     91791552 (   87.5 MiB) Virtual address space used                                            MALLOC:"                                            MALLOC:           1398              Spans in use                                            MALLOC:             34              Thread heaps in use                                            MALLOC:           4096              Tcmalloc page size                                            ------------------------------------------------                                            Call ReleaseFreeMemory() to release freelist memory to the OS (via madvise()).                                            Bytes released to the OS take up virtual address space but no physical memory."                }        },        "mem" : {#mongod系统架构和当前内存使用情况                "bits" : 64,#MongoDB的位数:6432                "resident" : 91,#大致等于当前进程所用的RAM的值,单位MB,在专用的数据库中这个值接近系统内存                "virtual" : 351,#mongod使用了的虚拟内存,单位MB                "supported" : true#指示底层系统是否支持扩展内存信息。False系统不支持扩展内存信息,则其他mem values不得访问数据库服务器        },        "metrics" : {#返回正在运行的mongod实例的状态等统计信息                "cursor" : {                        "timedOut" : NumberLong(1),                        "open" : {                                "multiTarget" : NumberLong(0),                                "singleTarget" : NumberLong(0),                                "pinned" : NumberLong(0),                                "total" : NumberLong(0)                        }                },                "commands" : {#数据库执行的命令                        "buildInfo" : {                                "failed" : NumberLong(0),#命令执行失败的次数                                "total" : NumberLong(565)#mongod执行命令的总次数                        },                        "count" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(2)                        },                        "find" : {                                "failed" : NumberLong(1),                                "total" : NumberLong(170)                        },                        "getLastError" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(556)                        },                        "getLog" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(3)                        },                        "getMore" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(159)                        },                        "insert" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(304434)                        },                        "isMaster" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(867124)                        },                        "listCollections" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(2)                        },                        "listDatabases" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(5)                        },                        "replSetGetStatus" : {                                "failed" : NumberLong(32),                                "total" : NumberLong(32)                        },                        "saslContinue" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(1414)                        },                        "saslStart" : {                                "failed" : NumberLong(4),                                "total" : NumberLong(714)                        },                        "serverStatus" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(2)                        },                        "whatsmyuri" : {                                "failed" : NumberLong(0),                                "total" : NumberLong(3)                        }                }        },        "ok" : 1}
参考地址:https://docs.mongodb.com/manual/reference/command/serverStatus/
原创粉丝点击