MongoDB Common troubleshooting tools

Source: Internet
Author: User
Tags flushes memory usage mongo shell

1.profile profiling levels:

0, close profile,1, crawl only slow query,2, fetch all data.

start profile and set the profile level:

      can be mongo shell can also be started by the profile command in the driver, and the record will be saved in system.profile collection , you can use db.setprofilinglevel to start. The default slow is 100    milliseconds. db.setprofilinglevel can have 2 parameters, the first parameter specifies profiling  level, second parameter       specify Slow valve value.

Check the current Profiling level: You can get the current Profiling by db.getprofilingstatus () Level,slowms tag slow query threshold.

Turn off Profiling: or use db.setprofilinglevel (0) to close Profiling

Entire instance open Profiling:mongod--prifile=1--slowms=15

Shard Profiling: The Profiling of shard to each instance Profiling

View Profiling data

can be viewed directly on system.profile 's collection such as:Db.systen.profile.find (). Or you can use showprofile to display the top 5 records that have been running at least 1ms of time.

Profiler Overview

the size of the system.profile collection to be modified must:1. Close profiling,2. Delete system.profile,3. Then re-create the system.profile,4. Restart Profile .

The shell is as follows :d b.setprofilinglevel (0)

, Db.system.profile.drop ()

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

, Db.setprofilinglevel (1)

2.mongostat mongostat N N: Refreshes the number of seconds to reflect the current Mongod loadhttp://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, on 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, returns the result at 2 seconds per intervalNS 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 SQLIOSim http://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. Connect

6. Additional Information

7. Index Counter

8.cursors

9. Network

Copy Set

One. number of replica set operation sets

Operating Counter

Assertion

14.writeBackQueued

15.Journal(dur) Persistence

16.recordStats

Working Set (workingset)

Indicators (metrics)

  6.db.stats ()   storage consumed by the reaction database{
"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.