MongoDB工具Mtools安装

1、安装Python3

yum -y install yum-utils

yum-builddep python

wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz

tar xf Python-3.8.0.tgz

cd Python-3.8.0

./configure

make

make install

2、设置Python3为默认版本

vi /etc/profile.d/python.sh #编辑用户自定义配置,输入alias参数

alias python='/usr/local/bin/python3.8'  #这里写你的python路径

source /etc/profile.d/python.sh    #重启会话使配置生效

3、安装pip

wget https://bootstrap.pypa.io/get-pip.pypython get-pip.py -i 

https://pypi.tuna.tsinghua.edu.cn/simple/

yum -y install epel-release

yum -y install python-pip

4、安装mtools

pip install mtools

5、常用命令

(1)、慢查询统计

显示所有慢查询,并按出现次数排序:

mloginfo mongo.log --queries --sort count

显示所有慢查询,并按总查询耗时排序:

mloginfo mongo.log --queries --sort sum

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容