MongoDB replica Set Configuration series eight: MongoDB monitoring

Source: Internet
Author: User
Tags mongodb monitoring

1:mongostat

MongoDB2.6 version

MongoDB3.0 version

2:db.setprofilinglevel (2): Open Profiler

MySQL-like slow log

The profiler is turned off by default, and you can choose to turn it all on, or when you have a slow query.

Db.setprofilinglevel (level,<slowms>) 0=off 1=slow 2=all

> Use testswitched to DB test> db.setprofilinglevel (2) 2015-07-01t00:24:49.770-0700 trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed2015-07-01t00:24:49.774-0700 reconnect 127.0.0.1:27017 (127.0.0.1) ok{"was": 0, " Slowms ": +," OK ": 1}> db.getprofilinglevel () 2> db.system.profile.find (). Sort ({$natural:-1})
    • TS: Time stamp
    • Info: Specific actions
    • Millis: Operation takes time, milliseconds
3:--httpinterface--rest: Open the Web Console

If you need to open the Web console, you need to add--httpinterface when Mongod is started--rest

4 db.stats (): Get current database information
> Db.stats () {"DB": "Test", "collections": 6, "Objects": 2309992, "avgobjsize": 48.00180260364538, "datasize": 1108837 "Storagesize": 198164480, "numextents":, "Indexes": 3, "indexsize": 74990272, "fileSize": 469762048, "NSSIZEMB": 16 , "Datafileversion": {"Major": 4, "minor": 5}, "Extentfreelist": {"num": 0, "TotalSize": 0}, "OK": 1}

  

5:db.serverstatus (): Gets the current state information for the server
> Db.serverstatus () {"Host": "Localhost.localdomain", "Version": "2.6.9", "process": "Mongod", "pid": Numberlong ( 22871), "uptime": 1558, "Uptimemillis": Numberlong (1558300), "uptimeestimate": 1428, "localtime": Isodate (" 2015-07-01t07:30:33.497z ")," asserts ": {" regular ": 0," warning ": 0," MSG ": 0," user ": 1," rollovers ": 0}," Backgroundflush ing ": {" Flushes ": +," Total_ms ": 2," Average_ms ": 0.08," Last_ms ": 0," last_finished ": Isodate (" 2015-07-01t07:29:35.233 Z ")},.........}

There are two places to be aware of:

Connections The current connection and the number of available connections, to 2000 connections are relatively many (to be based on your machine performance and business to set), so set a big meaningless. If you set a reasonable value, the MongoDB will reject the new connection request and avoid being dragged down by too many connections.
IndexCounters:btree:misses the number of misses of the index, and the ratio of hits to consider whether the index is correctly established.

  

6:db.currentop (): View the currently executing action
> Db.currentop ()
{"Opid": "shard3:466404288", "active": false, "Waitingforlock": False, "OP": "Query", "ns": "Sd.usersemails", "Query ": {}," client_s ":" 10.121.13.8:34473 "," desc ":" Conn "}

Kill if necessary:

Db.killop ("shard3:466404288")

  

  

MongoDB replica Set Configuration series eight: MongoDB monitoring

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.