MongoDB Common troubleshooting tools

Source: Internet
Author: User
Tags flushes memory usage mongodb mongo shell
MongoDB Common troubleshooting tools 1.profile Profiling levels:

0, close profile;1, only crawl slow query; 2, crawl all data. start profile and set profile level:

Can be launched through the MONGO shell, but also through the Drive Profile command to start, after the boot record will be saved under System.profile collection, you can use the Db.setprofilinglevel to start. The default slow is 100 milliseconds. Db.setprofilinglevel can have 2 parameters, the first parameter specifies the profiling level, and the second parameter specifies the slow threshold.

Check the current profiling level: You can get the current profiling level by Db.getprofilingstatus (), slowms tag slow query threshold.

Turn off profiling: or use Db.setprofilinglevel (0) to close the profiling

the entire instance opens profiling: Mongod--prifile=1--slowms=15

Shard profiling: Profiling to Shard to profiling view profiling data for each instance

System.profile can be viewed directly on collection such as: Db.systen.profile.find (). Or you can use show profile to display the first 5 records that have been running at least the last 1ms of time. Profiler Overview

To modify the size of the System.profile collection must be: 1. Close profiling,2. Delete system.profile,3. And then recreate the system.profile,4. Restart profile.

Shell is as follows: Db.setprofilinglevel (0)

, Db.system.profile.drop ()

, Db.createcollect ("System.profile", {cappedltrue,size:4000000})

, Db.setprofilinglevel (1)2.Mongostat mongostat n : Refresh seconds response to current Mongod load http://docs.mongodb.org/manual/reference/program/mongostat/ Inserts-# of inserts per second (* means replicated op)
Query-# of queries per second
Update-# of updates per second
Delete-# of deletes per second
Getmore-# of Get mores (cursor batch) per second
Command-# of commands per second in a slave its local|replicated
Flushes-# of Fsync flushes per second
Mapped-amount of data mmaped (total data size) Megabytes
Vsize-virtual size of process in megabytes
Res-resident size of process in megabytes
Faults-# of pages faults per sec
Locked-name of and percent time for most locked database
IDX miss-percent of Btree page misses (sampled)
Qr|qw-queue lengths for clients Waiting (Read|write)
Ar|aw-active Clients (Read|write)
Netin-network Traffic In-bits
Netout-network Traffic Out-bits
Conn-number of open connections
Set-replica Set Name
Repl-replication type
Pri-primary (Master)
Sec-secondary
Rec-recovering
Unk-unknown
Slv-slave
Rtr-mongos process ("router")3.Mongoop Collection level response, time to read and writehttp://docs.mongodb.org/manual/reference/program/mongotop/mongotop-h 192.168.10.69 2, 2 seconds per interval return resultsNS Total Read Write 2014-05-09t14:00:55
Ub1405.system.users 0ms 0ms 0ms
Ub1405.system.profile 0ms 0ms 0ms
B1405.system.namespaces 0ms 0ms 0ms
Ub1405.system.indexes 0ms 0ms 0ms
ub1405. Waprecommend 0ms 0ms 0ms
ub1405. Visitpageinfo 0ms 0ms 0ms
ub1405. Usageinfo 0ms 0ms 0ms
ub1405. Upgradeinfo 0ms 0ms 0ms
ub1405. Switch 0ms 0ms 0ms  4.mongoperf used to test IO performance, can be used to do MONGO IO stress testing, and SQL Server SQLIOSimhttp://docs.mongodb.org/manual/reference/program/mongoperf/  5. Serverstatus db.serverstatus ()   contains a lot of information

1. Instance Information

2. Lock

3. Global Lock

4. Memory usage

5. Connection

6. Additional Information

7. Index counter

8.cursors

9. The Network

10. Replica set

11. Replica set operation set number

12. Operation Counter

13. Asserts that

14.writeBackQueued

15.Journal (dur) durability

16.recordStats

17. Working Set (WorkingSet)

18. Indicators (metrics)  6.db.stats ()   the storage that the reaction database occupies{
"DB": "ub1405",
"Collections": 17,
"Objects": 9939344,
"Avgobjsize": 336.2453477815035,
"DataSize": 3342058180,
"Storagesize": 4501643264,
"Numextents": 111,
"Indexes": 15,
"Indexsize": 322633136,
"FileSize": 8519680000,
"Nssizemb": 16,
"Datafileversion": {
"Major": 4,
"Minor": 5
},
"OK": 1
}7.Db.collection.stats () returns some information about the collection: {
"NS": "ub1405." Waprecommend ",
"Count": 514,
"Size": 174416,
"Avgobjsize": 339.3307392996109,
"Storagesize": 430080,
"Numextents": 3,
"Nindexes": 1,
"Lastextentsize": 327680,
"Paddingfactor": 1,
"Systemflags": 1,
"UserFlags": 0,
"Totalindexsize": 24528,
"Indexsizes": {
"_id_": 24528
},
"OK": 1
}

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.