Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use mtools Log Analysis tool in mongodb

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to use mtools log analysis tools in mongodb. The content of the article is of high quality, so Xiaobian shares it with you for reference. I hope you have a certain understanding of relevant knowledge after reading this article.

installation process

yum -y install glibc-devel python-devel

yum -y install python-pip

yum -y install python-pymongo

pip install mtools

yum -y install glibc-devel python-devel

wget -O - ftp://ftp.no.sohu.com/pub/software/unix/Mongodb/utils/psutil-4.3.1.tar.gz | tar -zxvf - cd psutil-4.3.1

python setup.py install

yum -y install python-{ordereddict,argparse,dateutil,matplotlib,nose,pymongo,psutil}

yum -y install numpy pip install --upgrade matplotlib

wget -O - ftp://ftp.no.sohu.com/pub/software/unix/Mongodb/utils/mtools-1.2.1.tar.gz | tar -zxvf - cd mtools-1.2.1

python setup.py install

instructions for use

For detailed instructions, please refer to: URL below

mloginfo

Make statistics on the most common situations in the log

# mloginfo mongod.log

Count client connections

# mloginfo mongod.log --connections

Count the number of times various types of information appear

# mloginfo mongod.log --distinct

Statistical information such as the number of executions and the time taken by the statement

# mloginfo mongod.log --queries

Statistics of MongoDB process startup information

# mloginfo mongod.log --restart

mlogfilter Filter Log

a. Display from a certain point in time

mlogfilter mongod.log --from 2018 Apr 6 0:00 | head

b. View logs for the last hour

# mlogfilter mongod.log --from "end -1h" | head -n3

c. Take logs one hour after a certain point in time

mlogfilter mongod.log --from Apr 6 0:00 --to "+1h" | tail -n3

Filter table name

mlogfilter mongod.log --namespace serverside.user | head -n3

operation type

mlogfilter mongod.log --operation update | head -n3

Look at the number of connections.

mlogfilter mongod.log --thread conn3860

slow query

mlogfilter mongod.log --slow 600000 | head -n3

Too many queries scanned

mlogfilter mongod.log --scan | head -n3

About how to use mtools log analysis tools in mongodb to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report