当前位置: 首页 > 工具软件 > Mtools > 使用案例 >

工具mtools安装

章烨烨
2023-12-01

Mtools工具介绍

可以在源码包解压目录中,读取README.rst。也可以在github上https://github.com/rueckstiess/mtools下拉菜单可以看到,和readme.rst 是一样的

mtools is a collection of helper scripts to parse, filter, and visualize MongoDB log files (mongod, mongos). mtools also includes mlaunch, a utility to quickly set up complex MongoDB test environments on a local machine.

Mtools是帮助解析、过滤、可视化mongodb日志文件的一系列集合。它也包含mlaunch工具(可以快速的在本地服务器上部署复杂的mongodb测试环境)

Mtools工具组成
The following tools are in the mtools collection:

  • mlogfilter

slices log files by time, merges log files, filters slow queries, finds table scans, shortens log lines, filters by other attributes, convert to JSON

  • mloginfo

returns info about log file, like start and end time, version, binary, special sections like restarts, connections, distinct view

  • mplotqueries

visualize log files with different types of plots (requires matplotlib)

  • mlogvis

creates a self-contained HTML file that shows an interactive visualization in a web browser (as an alternative to mplotqueries)

  • mlaunch

a script to quickly spin up local test environments, including replica sets and sharded systems (requires pymongo)
For more information, see the mtools documentation.

安装需求和说明
The mtools collection is written in Python, and most of the tools only use the standard packages shipped with Python. The tools are currently tested with Python 2.7 and 3.6.
Some of the tools have additional dependencies, which are listed under the specific tool’s section. See the installation instructionsfor more information.
The mtools suite is only tested with actively supported (non End-of-Life) versions of the MongoDB server. As of April 2018, that includes MongoDB 3.2 or newer.

Mtools工具下载

https://github.com/rueckstiess/mtools

在下面中的release中可以选择要下载的版本

截止笔记整理今天(2018-09-02),最新的版本是mtools-1.5.1,下载源码包

Mtools工具安装

安装python3.7

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

[root@mysql-2 ~]# tar -xvf Python-3.7.0.tgz

[root@mysql-2 ~]# cd Python-3.7.0/
[root@mysql-2 Python-3.7.0]# ./configure –prefix=/usr/local/python3.7

[root@mysql-2 Python-3.7.0]# make
[root@mysql-2 Python-3.7.0]# make install

在make install最后报错如下
ModuleNotFoundError: No module named ‘_ctypes’
make: * [install] Error 1

解决是安装下面包
[root@mysql-2 Python-3.7.0]# yum install libffi-devel -y

然后从新make install最后就得到下面
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-10.0.1 setuptools-39.0.1

[root@mysql-2 Python-3.7.0]# cd /usr/local/python3.7/
[root@mysql-2 python3.7]# ls
bin include lib share
[root@mysql-2 python3.7]# cd bin
[root@mysql-2 bin]# ls
2to3 easy_install-3.7 idle3.7 pip3.7 pydoc3.7 python3.7 python3.7m python3-config pyvenv-3.7
2to3-3.7 idle3 pip3 pydoc3 python3 python3.7-config python3.7m-config pyvenv

安装mtools工具

在源码包解压目录里,有个INSTALL.md文件。也可以从github上看到如下图

两个说法是一样的,有两种安装Installation from source和Installation with pip。Pip需要上网,因此采用source安装

[root@mysql-2 ~]# tar -xvf mtools-1.5.1.tar.gz
[root@mysql-2 ~]# cd mtools-1.5.1/
[root@mysql-2 mtools-1.5.1]# /usr/local/python3.7/bin/python3.7 setup.py install

中途输出,可以看出有些工具安装在python目录下了
Adding mtools 1.5.1 to easy-install.pth file
Installing mgenerate script to /usr/local/python3.7/bin
Installing mlaunch script to /usr/local/python3.7/bin
Installing mlogfilter script to /usr/local/python3.7/bin
Installing mloginfo script to /usr/local/python3.7/bin
Installing mlogvis script to /usr/local/python3.7/bin
Installing mplotqueries script to /usr/local/python3.7/bin

最后输出
Installed /usr/local/python3.7/lib/python3.7/site-packages/six-1.11.0-py3.7.egg
Finished processing dependencies for mtools==1.5.1

[root@mysql-2 bin]# cd /usr/local/python3.7/bin
[root@mysql-2 bin]# ll -thr
total 27M
-rwxr-xr-x 2 root root 14M Sep 4 00:20 python3.7m
-rwxr-xr-x 2 root root 14M Sep 4 00:20 python3.7
-rwxr-xr-x 1 root root 451 Sep 4 00:21 pyvenv-3.7
-rwxr-xr-x 1 root root 94 Sep 4 00:21 pydoc3.7
-rwxr-xr-x 1 root root 109 Sep 4 00:21 idle3.7
-rwxr-xr-x 1 root root 111 Sep 4 00:21 2to3-3.7
-rwxr-xr-x 1 root root 3.1K Sep 4 00:21 python3.7m-config
lrwxrwxrwx 1 root root 9 Sep 4 00:21 python3 -> python3.7
lrwxrwxrwx 1 root root 17 Sep 4 00:21 python3.7-config -> python3.7m-config
lrwxrwxrwx 1 root root 16 Sep 4 00:21 python3-config -> python3.7-config
lrwxrwxrwx 1 root root 7 Sep 4 00:21 idle3 -> idle3.7
lrwxrwxrwx 1 root root 8 Sep 4 00:21 pydoc3 -> pydoc3.7
lrwxrwxrwx 1 root root 8 Sep 4 00:21 2to3 -> 2to3-3.7
lrwxrwxrwx 1 root root 10 Sep 4 00:21 pyvenv -> pyvenv-3.7
-rwxr-xr-x 1 root root 252 Sep 4 00:21 easy_install-3.7
-rwxr-xr-x 1 root root 234 Sep 4 00:21 pip3.7
-rwxr-xr-x 1 root root 234 Sep 4 00:21 pip3
-rwxr-xr-x 1 root root 403 Sep 4 00:30 mlogfilter
-rwxr-xr-x 1 root root 397 Sep 4 00:30 mlaunch
-rwxr-xr-x 1 root root 401 Sep 4 00:30 mgenerate
-rwxr-xr-x 1 root root 407 Sep 4 00:30 mplotqueries
-rwxr-xr-x 1 root root 397 Sep 4 00:30 mlogvis
-rwxr-xr-x 1 root root 399 Sep 4 00:30 mloginfo
[root@mysql-2 bin]#

 类似资料: