How to Use MongoDB performance analysis tool mongostat

Source: Internet
Author: User
Tags flushes install mongodb mongodb query mongodb server openssl library

How to Use MongoDB performance analysis tool mongostat

Mongostat is a MongoDB performance analysis tool used to check the running status of mongodb.

Test: Test/node-131/# restart stat -- help
Usage:
Using stat <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 = -- 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
-- Authenticationmechanic = <mechanic> authentication mechanic to use

Stat options:
-- Noheaders dont output column names
-N, -- rowcount = <count> number of stats lines to print (0 for indefinite)
-- Discover nodes and display stats for all
-- Http use HTTP instead of raw db connection
-- All optional fields
-- Json output as JSON rather than a formatted table

Example:

20 seconds of data, output every 1 second

Unzip stat-h 80.81.2.3-p 27017 -- rowcount 20 1

300 seconds of data, output every 5 seconds

Unzip stat-h 80.81.2.3-p 27017-n 300 5

Output in json format

Unzip stat-h 80.81.2.4-p 27017-n 60 1 -- json

Collects the running status of all nodes in the acsag of the replica set within 60 s, refresh every 1 s, and save it to the mongostat_aCloud.log file.

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

Monitor the status of the 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
4327000 445 748 | 0 0.5 4.1 0 1.1G 437.0 M 0 | 0 0 0 | 0 834 k 1 m 7 aCloud PRI 2016-07-21T20: 56: 48 + 08: 00
3857
000 442 752 | 0 0.5 4.1 0 1.1G 438.0 M 0 | 0 0 0 | 0 771 k 1 m 7 aCloud PRI 2016-07-21T20: 56: 49 + 08: 00

Result parsing:

insert instert operations per second
query query operations per second
update the number of update operations per second
delete delete operations per second
getmore getmore operations per second
command command executions per second
flushes the number of times fsync is performed to write data to the hard disk per second
vsize virtual memory usage in MB
res physical memory usage in MB
qr | qw Waiting reads / writes in the queue
ar | aw Number of active read / writes
netIn Receiver network speed in bytes
netOut sending network speed, unit is bytes
conn connections
set replica set name
The state of the repl member in the replication set (PRI | SEC | ARB | REC) 

For more MongoDB tutorials, see the following:

Introduction to MongoDB documents, collections, and databases

MongoDB 3 shard deployment and Fault Simulation

Install MongoDB in CentOS 6.5 yum

Quick installation of MongoDB using CentOS 7 yum

MongoDB query operations

Quickly build MongoDB clusters on Azure virtual machines

Principles of MongoDB replica set

MongoDB 3.4 remote connection authentication failed

Install MongoDB3.4 database system in Ubuntu 16.04

MongoDB authoritative guide 2nd PDF complete with bookmarks directory download see

MongoDB details: click here
MongoDB: click here



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.