Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Usage of mongostat tools in Mongodb database

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Mongostat is a tool that comes with mongoDB to detect the running status of mongodb.

Test:Test/node-131 / # mongostat-- help

Usage:

Mongostat

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= 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= mongodb host to connect to (setname/host1,host2 for replica sets)

-- port= server port (can also use-- host hostname:port)

Ssl options:

-- ssl connect to a mongod or mongos that has ssl enabled

-- sslCAFile= the .pem file containing the root certificate chain from the certificate authority

-- sslPEMKeyFile= the .pem file containing the certificate and key

-- sslPEMKeyPassword= the password to decrypt the sslPEMKeyFile, if necessary

-- sslCRLFile= 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 for authentication

-p,-- password= password for authentication

-- authenticationDatabase= database that holds the users credentials

-- authenticationMechanism= authentication mechanism to use

Stat options:

-- noheaders dont output column names

-n,-- rowcount= 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

For example:

20 seconds of data, output every 1 second

Mongostat-h 80.81.2.3-p 27017-rowcount 20 1

300 seconds of data, output every 5 seconds

Mongostat-h 80.81.2.3-p 27017-n 300 5

Export in json format

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

Collect the running status of all nodes in the replication set aCloud within 60s, refresh it at intervals of 1 second, and save it to the file mongostat_aCloud.log.

Mongostat-h aCloud/80.81.2.4,80.81.2.5,80.81.2.6-p 27017-n 601 > > mongostat_aCloud.log

Monitoring the status of replication set Primary node 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 00 0 445 748 | 0 0.5 4.1 0 1.1 G 437.0M 0 | 00 | 0 834k 1m 7 aCloud PRI 2016-07-21T20:56:48+08:00

3857 000 442,752 | 0 0.5 4.1 0 1.1 G 438.0 M 0 | 00 | 0 771k 1m 7 aCloud PRI 2016-07-21T20:56:49+08:00

Analysis of the results:

Insert instert operations per second query query operations per second update update operations per second delete operations per second getmore operations per second command operations per second command execution times per second flushes execution of fsync to write data to hard disk per second vsize virtual memory usage, in MBres physical memory usage, unit MBqr | number of waiting reads / writes in qw queue ar | aw activated active read / write netIn receiver network rate, in bytesnetOut sender network rate Unit is the number of bytesconn connections (open connections) set replication set (replica set) name the status of the repl member in the replication set (PRI | SEC | ARB | REC)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report