3.26. MongoDB monitoring

发布时间 : 2025-10-25 13:34:24 UTC      

Page Views: 9 views

After you have installed and deployed and allowed the MongoDB service, you must understand the operation of MongoDB and check the performance of MongoDB. In this way, in the case of large traffic, we can deal with it well and ensure the normal operation of MongoDB.

Mongostat and mongotop commands are provided in MongoDB to monitor the operation of MongoDB.

3.26.1. Mongostat command

Mongostat is a status detection tool that comes with mongodb and is used on the command line. It gets the current running state of mongodb at regular intervals and outputs it. If you find that the database suddenly slows down or has other problems, your first-hand operation should consider using mongostat to check the status of mongo.

Start your Mongod service, go to the bin directory under the MongoDB directory where you installed it, and enter the mongostat command, as shown below:

D:\set up\mongodb\bin>mongostat 

The output of the above command is as follows:

Image0

3.26.2. Mongotop command

Mongotop is also a built-in tool under mongodb, and mongotop provides a way to track an instance of MongoDB to see which time is spent reading and writing data. Mongotop provides statistics at the level of each collection. By default, mongotop returns every second of the value.

Start your Mongod service, go to the bin directory under the MongoDB directory where you installed it, and enter the mongotop command, as shown below:

D:\set up\mongodb\bin>mongotop 

The output of the above command execution is as follows:

Image1

Instance with parameters

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

Image2

The last 10 is Parameter, can not be used, the length of time to wait, in seconds, between mongotop waiting for the call. The default mongotop that passes returns every second of the data.

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

Report the use of locks for each database, using mongotop-locks, which produces the following output:

Image3

Output result field description:

  • ns:

    Contains the database namespace, which combines the database name with the collection.

  • db:

    Contains the name of the database. It’s called. The database is for global locking, not for specific databases.

  • total:

    The time mongod spends working on this namespace provides the total amount.

  • read:

    A lot of time is provided, and this mongod spends on performing read operations in this namespace.

  • write:

    It takes a lot of time for mongod to provide this namespace for writing.

《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。