In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
How to use mongoDB monitoring tools, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Mongostat
Mongostat captures and returns the count of various types of database operations, such as insert, query, update, delete, and so on. These counts show the load distribution on the server. Use mongostat to understand the distribution of operation types and inform capacity planning. See mongotop manual for more information.
Mongotop
Mongotop tracks and reports the current read and write activity of the MongoDB instance and reports these statistics on a per-collection basis. Use mongotop to check whether the activity and usage of the database meets your expectations. See mongotop manual for more information.
These two tools are located in the bin directory:
[mongo@tstdb-25-220bin] $pwd/usr/local/mongodb/ [mongo @ tstdb-25-220bin] $ll total dosage 174480-rwxr-xr-x. 1 mongo dbmon 4722768 April 28 2016 bsondump-rwxr-xr-x. 1 mongo dbmon 20987301 April 28 2016 mongo-rwxr-xr-x. 1 mongo dbmon 36731194 April 28 2016 mongod-rwxr-xr-x. 1 mongo dbmon 10796256 April 28 2016 mongodump-rwxr-xr-x. 1 mongo dbmon 6607288 April 28 2016 mongoexport-rwxr-xr-x. 1 mongo dbmon 6457168 April 28 2016 mongofiles-rwxr-xr-x. 1 mongo dbmon 6724760 April 28 2016 mongoimport-rwxr-xr-x. 1 mongo dbmon 6190176 April 28 2016 mongooplog-rwxr-xr-x. 1 mongo dbmon 36436521 April 28 2016 mongoperf-rwxr-xr-x. 1 mongo dbmon 13542128 April 28 2016 mongorestore-rwxr-xr-x. 1 mongo dbmon 16749560 April 28 2016 mongos-rwxr-xr-x. 1 mongo dbmon 6419256 April 28 2016 mongostat-rwxr-xr-x. 1 mongo dbmon 6273904 April 28 2016 mongotop
Run mongostat and look at the relevant output
[mongo@tstdb-25-220bin] $. / mongostat-h 172.16.25.225-p 27017-u root-p mongo-- authenticationDatabase=admin-- rowcount=10 1insert query update delete getmore command flushes mapped vsize res faults qr | qw ar | aw netIn netOut conn set repl time * 0 * 0 * 0 * 003 | 0 01.2G 3.3G 110.0M 00 | 0 0 | 0 401b 13k 3 moe SEC 2016 -11-01T10:42:59+08:00 * 0 * 0 * 00 1 | 00 1.2G 3.3G 110.0M 00 | 00 | 0 79b 12k 3 moe SEC 2016-11-01T10:43:00+08:00 * 0 * 0 * 00 3 | 00 1.2G 3.3G 110.0M 00 | 00 | 0401b 13k 3 moe SEC 2016-11-01T10:43:01+08:00 * 0 * 0 * 00 1 | 00 1.2G 3.3G 110.0M 00 | 00 | 0 79b 12k 3 moe SEC 2016-11-01T10:43:02+08:00 * 0 * 0 * 00 3 | 00 1.2G 3.3G 110.0M 00 | 0 | 0 401b 13k 3 moe SEC 2016-11-01T10:43:03+08:00 * 0 * 0 * 0 * 00 1 | 00 1.2G 3.3G 110.0M 00 | 00 | 079b 12k 3 moe SEC 2016-11-01T10:43:04+08:00 * 0 * 0 * 00 3 | 00 1.2G 3.3G 110.0m | 00 | 0 401b 13k 3 moe SEC 2016-11-01T10:43:05+08:00 * 0 * 0 * 0 * 00 1 | 00 1.2G 3.3G 110.0M 00 | 00 | 079b 12k 3 moe SEC 2016-11-01T10:43:06+08:00 * 0 * 0 * 0 * 00 3 | 00 1.2G 3 .3G 110.0M 00 | 00 | 0 401b 13k 3 moe SEC 2016-11-01T10:43:07+08:00 * 0 * 0 * 0 * 00 1 | 00 1.2G 3.3G 110.0M 00 | 00 | 0 79b 12k 3 moe SEC 2016-11-01T10:43:08+08:00
Mainly explain the significance of each column in detail (you can also refer to. / mongostat-- help)
Insert: number of inserts in a second
Query: the number of queries in a second
Update: number of updates in a second
Delete: number of deletions in a second
Ten simple queries may be faster than one complex query, so the size of the number doesn't make much sense. But at least you can know if the query is being processed and whether it is being inserted. If it is slave, the value is usually preceded by a *, which represents a replicate operation.
Getmore: getmore operation of cursor when querying
Command: the number of commands executed in a second
For example, bulk insertion is only considered to be a command. It doesn't mean much. If it is slave, two values, local | replicated, will be displayed. By comparing these two values, you may be able to see some problems.
Flushes: the number of flush in a second
It's usually 0, or 1, and by calculating the interval between two 1s, you can get a rough idea of how long it takes to flush. Flush costs a lot, and if you have frequent flush, you may have to find out why.
Mapped:
Vsize:
Res:
This is the same as what you can see with top, mapped, vsize generally will not change much, res will rise slowly, if res often suddenly drop, check to see if there are other programs eating memory.
Faults:
Don't be frightened by the name. Under great pressure, the value is often not zero. If it is often not 0, it is time to add memory.
Locked:
MongoDB is a read-write lock, which refers to the percentage of time that the write lock resides. If this number is too large (often more than 10%), something is wrong.
Idx miss:
Very important parameters, normally, all queries should pass the index, that is, idx miss is 0. If the value here is large, is there a lack of index?
Qr | qw: queue lengths for clients waiting (read | write)
Ar | aw: active clients (read | write)
If these two values are large, then DB is blocked and DB is not as fast as the request. See if there are expensive slow queries. If everything is normal and the load is really heavy, you need to add the machine.
NetIn: network traffic in-bits
NetOut: network traffic out-bits
Network bandwidth pressure, general MongoDB, the network will not become a bottleneck
Conn: number of open connections
MongoDB creates a thread for each connection, and thread creation and release also have overhead. Try not to let this number be too large.
Repl: current status of the server
M-master
SEC-secondary
REC-recovering
UNK-unknown
SLV-slave
Time: current Tim
Let's take a look at mongotop.
[mongo@tstdb-25-220bin] $. / mongotop-h 172.16.25.220-p 27017-u root-p mongo-authenticationDatabase=admin2016-11-01T10:54:01.683+0800 connected to: 172.16.25.220 ns total read write 2016-11-01T10:54:02+08:00 admin.system.indexes 0ms 0ms 0ms admin. System.js 0ms 0ms 0ms admin.system.namespaces 0ms 0ms 0ms admin.system.profile 0ms 0ms 0ms admin.system.roles 0ms 0ms 0ms admin.system.users 0ms 0ms 0ms admin.system.version 0ms 0ms 0ms local.me 0ms 0ms 0ms local.oplog.rs 0ms 0ms 0ms local.replset.election 0ms 0ms 0ms
When testing these two tools, you can only choose "admin" this database, choose other databases, and use the authentication accounts of other libraries.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.