"Turn" MongoDB monitoring tool Mongostat

Source: Internet
Author: User
Tags bulk insert mongodb monitoring rowcount

(Transferred from: http://www.cnblogs.com/zhuque/archive/2013/03/29/2988577.html)

Mongostat is a state detection tool that is mongdb, and is used under the command line. It will take a fixed time to get the current running state of MongoDB and output. If you find that the database is suddenly slow or has other problems, your first-hand action is to consider using Mongostat to see the status of Mongo.

Mongostat command format, of course, can also add parameters:

In the first example, Mongostat will return every second of the data for 20 seconds. Mongostat collects data on the Mongod instance running on the local host interface Port 27017. All of the following calls produce the same behavior: Mongostat-RowCount1Mongostat-RowCount -Mongostat-n 1mongostat-n 20 In the following example, MONGOSTAT returns data every 5 minutes (300 seconds) as long as the program is running. Mongostat collects data on the Mongod instance running on the local host interface Port 27017. The following two types of calls produce the same behavior. Mongostat-RowCount0Mongostat-n 0 300mongostat 300 in the following example, the data returned by Mongostat every 5 minutes one hours (12 times). Mongostat collects data on the Mongod instance running on the local host interface Port 27017. The following two types of calls produce the same behavior. Mongostat-RowCount theMongostat-n 12 300 In many cases, use-Discoverwill help the whole group of machines to provide a more complete snapshot of the state. If the MONGOs process is connected to port 27017 on a chip cluster running on the local machine, you can use the following form to return statistics from all members of the cluster:

Mongostat- Discover

Reference Document:http://cn.docs.mongodb.org/manual/reference/mongostat/

The main details of the column of the meaning (also can refer to./mongostat--help)

Insert:     Number of inserts in one second query:     Number of queries in one second update:     Updates in one second delete:     deleted in one second   10 simple queries may be faster than a complex query, so the size of the values is not very significant.   But at least you can know if the query is now being processed, whether it is inserted.   If it is slave, there is always a *, which means replicate action  getmore:     cursor Getmore action   useful     Www.2cto.com  command:     Number of commands executed in a second   for example, BULK INSERT, only one command is considered. It doesn't make much sense.   If it is slave, will show two values, local|replicated, through the comparison of these two values, may be able to see the point of the problem.   flushes:     The number of flush times in a second    generally 0, or 1, by calculating the interval between two 1, you can get a general idea of how long it takes to flush once.   Flush overhead is great, and if you flush frequently, you may want to find out why.     mapped:     vsize:res:  This is the same as you see with top, mapped, vsize generally do not have big changes, res will slowly rise, If the res often drops suddenly, check to see if any other program is eating memory.   faults:  don't be frightened by the name, this value is often not 0 under pressure. If it's often not 0, it's time to add memory.   locked:  MongoDB is a read-write lock, which refers to the percentage of time that a write lock lives. This value is too large (often more than 10%), that is the situation.   idx miss:  Very important parameters, normally, all queries should be indexed, that is, the idx miss is 0. If the value here is large, the index is missing.   qr|qw:queue Lengths for CLIents Waiting (read|write) ar|aw:active clients (Read|write)   If these two values are large, then the DB is blocked and the DB processing speed is less than the requested speed.   See if there is a lot of slow queries that are expensive. If the query is all right, it is really a heavy load, you need to add the machine.   netin:network Traffic in-bitsnetout:network Traffic out-bits  network bandwidth pressure, General MongoDB, the network will not become a bottleneck  conn: Number of open connections  MongoDB creates a thread for each connection, and the creation and release of threads is also overhead. Try not to make this a large number.  REPL: Server current status     M  -master    sec-secondary    rec-recovering    unk-unknown    slv-slave    time: Current time

If you execute the mongostat command in a CMD window under Windows, it may be because the window is too narrow, the monitoring data arrangement is disorderly and hinder the visual situation, you can output the results to a TXT file, and then go to view this file, the way is twists and turns some haha.

E:\mongodb-win32-x86_64-2.2.1\bin\mongostat-n 2 > E:\test.txt

Prints 2 rows of results to the test.txt of the E-drive in the directory.

Reference Document: http://cn.docs.mongodb.org/manual/reference/mongostat/
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.