MongoDB monitoring tool mongostat

Source: Internet
Author: User
Tags mongodb monitoring rowcount

Mongostat is a state detection tool that comes with mongdb. It is used in the command line. It will get the current running status of mongodb at a fixed interval and output it. If you find that the database suddenly slows down or has other problems, you will first consider using mongostat to view the mongo status.

You can also add parameters to the Command Format of unzip stat:

In the first example, each second of data will be returned by stat, lasting 20 seconds. Port 27017 of the local host interface running on the mongod instance where mongostat collects data. All of the following calls generate the same behavior: Repeated stat-rowcount 20 1 partial stat-rowcount 20 partial stat-N 20 1 partial stat-N 20 in the following example, each 5 minutes (300 seconds) returned by the worker stat, as long as the program is running. Port 27017 of the local host interface running on the mongod instance where mongostat collects data. The following two calls generate the same behavior. Statistics stat-rowcount 0 300 statistics stat-N 0 300 statistics stat 300 in the following example, the data returned by statistics stat is one hour (12 times) every five minutes ). Port 27017 of the local host interface running on the mongod instance where mongostat collects data. The following two calls generate the same behavior. Using stat-rowcount 12 300 running stat-N 12 300 in many cases, using-discover will help the status of the entire group of machines and provide more complete snapshots. If Mongos is connected to port 27017 running on a local machine on a chip cluster, you can use the following format to return statistics from all members of the Cluster:

Unzip stat-discover

The above Reference documents: http://cn.docs.mongodb.org/manual/reference/mongostat/

 

It mainly describes the significance of each column in detail (you can also refer to./mongostat -- help)

Insert: Number of inserts in one second query: number of queries in one second update: number of updates in one second delete: deleting dozens of simple queries within one second may be faster than a complex query, so the value size is not significant. At least you can know whether the query is being processed and whether the query is being inserted. If it is slave, there is always a * Before the value, which indicates that the getmore operation of the replicate operation getmore: The cursor (cursor) is not very useful when querying www.2cto.com command: the number of commands executed in one second, such as batch insertion, is considered to be only one command. Not significant. If it is slave, two values will be displayed, local | replicated. Through the comparison of these two values, we may see some problems. Flushes: the number of flush operations in a second is generally 0 or 1. By calculating the interval between two 1 s, you can roughly know how long the flush operation takes. The overhead of flush is very large. If it is frequently flush, you may need to find the cause. Mapped: vsize: res: This is the same as what you see in top. mapped and vsize generally do not change much, and res will gradually increase. If res often drops suddenly, check whether there are other programs that eat the memory. Faults: Do not be scared by this name. The value is usually not 0 under heavy pressure. If it is often not 0, the memory should be added. Locked: MongoDB has a read/write lock, which refers to the percentage of time occupied by the write lock. This value is too large (often more than 10%), that is, the situation. Idx miss: a very important parameter. Normally, all queries should be indexed, that is, idx miss is 0. If the value here is large, is the index missing. Qr | qw: queue lengths for clients waiting (read | write) ar | aw: active clients (read | write) if the two values are large, the database is blocked, the DB processing speed is lower than the request speed. Check whether there is a high-cost slow query. If the query is normal, it is indeed a heavy load, you need to add machines. NetIn: network traffic in-bitsnetOut: network traffic out-bits network bandwidth pressure. Generally, in MongoDB, the network will not become a bottleneck. conn: number of open connections MongoDB creates a thread for each connection, thread creation and release are also overhead. Try not to make this value very large. Repl: current server status M-master SEC-secondary REC-recovering UNK-unknown SLV-slave time: Current time

If the cmdstat command is executed in the windows cmd window, the window may be too narrow, and the monitoring data is disordered, which may impede the vision. You can output the result to a txt file, then I went to view the file.

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

Print 2 rows to the test.txt directory of the e-drive.

Reference: 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.