Latest web development tutorials

MongoDB Monitoring

After you have installed the deployment and allows MongoDB service, you must understand the operation of MongoDB and see MongoDB performance. This can be a good deal and to ensure the normal operation of MongoDB was under major traffic situation.

MongoDB provides a mongostat and mongotop two commands to monitor the operation of MongoDB.

mongostat command

mongostat is mongodb carrying state detection tool, use the command line. It will be a fixed time interval to get the current operating state mongodb, and outputs. If you find the database suddenly slow down or have other questions, you first-hand operation is considered mongostat to view the status of mongo.

Start your Mongod service, go to the bin directory of your installation directory MongoDB under, and then enter mongostat command as follows:

D:\set up\mongodb\bin>mongostat

The above command output results are as follows:

mongotop command

A built-in tool mongotop also mongodb under, mongotop provides a method for tracking a MongoDB instance, and see what a lot of time spent reading and writing data. mongotop provide each horizontal set of statistics. By default, it mongotop return value every second.

Start your Mongod service, go to the bin directory of your installation directory MongoDB under, and then enter mongotop command as follows:

D:\set up\mongodb\bin>mongotop

Execute the above command output is as follows:

Examples of parameters

 E:\mongodb-win32-x86_64-2.2.1\bin>mongotop 10

Back 10 <sleeptime> parameter may not be used, the length of time to wait, in seconds, mongotop wait between calls. By default mongotop return data every second.

 E:\mongodb-win32-x86_64-2.2.1\bin>mongotop --locks

Lock usage reports for each database using mongotop - lock, which produces the following output:

Output Field Description:

  • ns:

    Namespace contains the database, which is a combination of the database name and collections.

  • db:

    Name of the database contains. Database named. For Global Lock, rather than a specific database.

  • total:

    Time spent in this work mongod namespace of the total available.

  • read:

    It offers a lot of time, which mongod spent performing a read operation in this namespace.

  • write:

    This namespace provides a write operation, which mongod spent a lot of time.