Mongodb数据库中mongostat工具用法

mongostat是mongoDB自带的工具,用于检测mongodb的运行状态。

Test:Test/node-131 / # mongostat --help
Usage:
mongostat <options> <polling interval in seconds>

Monitor basic MongoDB server statistics.

See http://docs.mongodb.org/manual/reference/program/mongostat/ for more information.

general options:
--help print usage
--version print the tool version and exit

verbosity options:
-v, --verbose=<level> more detailed log output (include multiple times for more verbosity, e.g. -vvvvv, or specify a numeric value, e.g. --verbose=N)
--quiet hide all log output

connection options:
-h, --host=<hostname> mongodb host to connect to (setname/host1,host2 for replica sets)
--port=<port> server port (can also use --host hostname:port)

ssl options:
--ssl connect to a mongod or mongos that has ssl enabled
--sslCAFile=<filename> the .pem file containing the root certificate chain from the certificate authority
--sslPEMKeyFile=<filename> the .pem file containing the certificate and key
--sslPEMKeyPassword=<password> the password to decrypt the sslPEMKeyFile, if necessary
--sslCRLFile=<filename> the .pem file containing the certificate revocation list
--sslAllowInvalidCertificates bypass the validation for server certificates
--sslAllowInvalidHostnames bypass the validation for server name
--sslFIPSMode use FIPS mode of the installed openssl library

authentication options:
-u, --username=<username> username for authentication
-p, --password=<password> password for authentication
--authenticationDatabase=<database-name> database that holds the users credentials
--authenticationMechanism=<mechanism> authentication mechanism to use

stat options:
--noheaders dont output column names
-n, --rowcount=<count> number of stats lines to print (0 for indefinite)
--discover discover nodes and display stats for all
--http use HTTP instead of raw db connection
--all all optional fields
--json output as JSON rather than a formatted table

举例:

20秒数据,每1秒钟输出

mongostat -h 80.81.2.3 -p 27017 --rowcount 20 1

300秒数据,每5秒输出

mongostat -h 80.81.2.3 -p 27017 -n 300 5

以json格式输出

mongostat -h 80.81.2.4 -p 27017 -n 60 1 --json

搜集复制集aCloud中所有节点的60s内运行状态,间隔1s刷新,保存到文件mongostat_aCloud.log中。

mongostat -h aCloud/80.81.2.4,80.81.2.5,80.81.2.6 -p 27017 -n 60 1 >> mongostat_aCloud.log

监控复制集Primary节点 80.81.2.4 的状态

Sangfor:aCloud/node-131 /var/lib/mongodb # mongostat -h 80.81.2.4 -p 27017 -n 60 1
insert query update delete getmore command % dirty % used flushes vsize res qr|qw ar|aw netIn netOut conn set repl time
4327 0 0 0 445 748|0 0.5 4.1 0 1.1G 437.0M 0|0 0|0 834k 1m 7 aCloud PRI 2016-07-21T20:56:48+08:00
3857
0 0 0 442 752|0 0.5 4.1 0 1.1G 438.0M 0|0 0|0 771k 1m 7 aCloud PRI 2016-07-21T20:56:49+08:00

结果解析:

insert 每秒instert操作次数
query 每秒query操作次数
update 每秒update操作次数
delete 每秒delete操作次数
getmore每秒getmore操作次数
command每秒command执行次数
flushes每秒执行fsync将数据写入硬盘的次数
vsize 虚拟内存使用量,单位是MB
res 物理内存使用量,单位MB
qr|qw 队列中waiting的读/写次数
ar|aw 已激活active的读/写次数
netIn 接收端网络速率,单位是bytes
netOut发送端网络速率,单位是bytes
conn 连接数(open connections)
set 复制集(replica set)名称
repl 成员在复制集中的状态(PRI|SEC|ARB|REC)

原文地址:http://blog.51cto.com/xiaocao13140/2071172

时间: 2024-08-08 21:12:48

Mongodb数据库中mongostat工具用法的相关文章

python 读取SQLServer数据插入到MongoDB数据库中

# -*- coding: utf-8 -*-import pyodbcimport osimport csvimport pymongofrom pymongo import ASCENDING, DESCENDINGfrom pymongo import MongoClientimport binascii '''连接mongoDB数据库'''client = MongoClient('10.20.4.79', 27017)#client = MongoClient('10.20.66.10

mongodb数据库中插入数据

一:connection 访问集合: 在mongodb数据库中,数据是存储在许多数据集合中,可以使用数据库对象的collection方法访问一个集合.该方法使用如下: db.collection(collectionName, [options], [callback]); collectionName参数值是一个字符串,用于指定需要访问的集合名,该参数是必须填写的.options参数值为一个对象,用于指定访问该集合时使用的选项,使用的属性可以百度搜索下,选项比较多,用到的时候可以查下.call

在MongoDB数据库中查询数据(上)

在MongoDB数据库中,可以使用Collection对象的find方法从一个集合中查询多个数据文档,find方法使用方法如下所示: collection.find(selector, [options]); selector值为一个对象,用于指定查询时使用的查询条件,options是可选的参数,该参数值是一个对象,用于指定查询数据时所选用的选项. find方法返回一个代表游标的Cursor对象,在该游标中包含了所有查询到的数据文档信息.可以使用Cursor对象的toArray方法获取所有查询到

MongoDB数据库中更新与删除数据

在MongoDB数据库中,可以使用Collection对象的update方法更新集合中的数据文档.使用方法如下所示: collection.update(selector, document, [options], [callback]); selector参数:该参数值为一个对象,用于查询需要更新的数据文档.该参数值指定的方法和我们前面使用的find方法中使用的selector参数值的指定方法完全相同. document参数:该参数值为一个对象,用于指定用来更新的数据文档. options参数

MongoDB数据库中查询数据(下)

在find中,options参数值为一个对象,用来设置查询数据时使用的选项,下面我们来对该参数值对象中可以使用的属性进行介绍: 1. fields; 该属性值为一个对象,该对象中各属性名用来显示指定在查询结果中需要包含或排除的字段.该属性值可以为1或0,当属性值为1时,代表需要在查询结果中包含该字段,当属性值为0时,代表需要在查询结果中排除该字段.注意:在使用fields属性时,需要统一使用属性值1或属性值0来设置除_id字段之外的所有字段. 首先我们来看下数据库中有哪些数据,如下所示: 下面我

【转】Oracle数据库中Sequence的用法

在Oracle数据库中,sequence等同于序列号,每次取的时候sequence会自动增加,一般会作用于需要按序列号排序的地方. 1.Create Sequence (注释:你需要有CREATE SEQUENCE或CREATE ANY SEQUENCE权限) CREATE SEQUENCE emp_sequence INCREMENT BY 1 —— 每次加几个 START WITH 1 —— 从1开始计数 NOMAXVALUE —— 不设置最大值 NOCYCLE —— 一直累加,不循环 CA

关于数据库中datareader的用法

1.C#中提供的DataReader可以从数据库中每次提取一条数据. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.OleDb; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplicat

关于MongoDB数据库中文件唯一性的问题

※重要※——介绍一下我的环境:MongoDB的“win32-x86_64-2008plus-ssl-3.0.5”,MongoVUE版本是1.6.9,VS2010,dll是1.10版本. MongoDB中文件的上传 试验①:使用VUE上传,{本地文件名相同,但文件内容不同},在VUE中直接点击“Add Files”上传文件,此时VUE会检查你的文件名是否重复,若重复就会给出提示“是改名?or还是跳过?”:这里咱们点击‘重命名’完成文件的上传,在VUE中可以看到如图所示:{前三个是我用VUE上传的}

Vue 添加评论,node作后台保存到MongoDB数据库中

成品图 1.在 textarea 中 v-model 双向绑定要添加的数据,并且 button 中绑定方法 2.将from表单绑定的数据挂载到data上 3. methods 中实现方法,将评论内容以参数形式传进 4.node中调用数据库的create方法添加进数据库 原文地址:https://www.cnblogs.com/zhaohui-116/p/12271161.html