如何在 CentOS 6 上安装 Mtop(MySQL 数据库服务器监控)

在本教程中,我们将向您展示如何在您的 CentOS 6 服务器上安装 Mtop(MySQL 数据库服务器监控)。 对于那些不知道的人,Mtop 是一个开源的实时 MySQL 服务器监控程序,它显示需要很长时间处理的查询,并在特定次数后终止那些较长的查询。 停止程序使我们能够从类似于 Linux Top Command 的命令行界面监控和识别 MySQL Server 的性能和相关问题。

本文假设您至少具备 Linux 的基本知识,知道如何使用 shell,最重要的是,您将网站托管在自己的 VPS 上。 安装非常简单。 我将向您展示如何在 CentOS 6 上逐步安装 Stop。

先决条件

  • 运行以下操作系统之一的服务器:CentOS 6。
  • 建议您使用全新的操作系统安装来防止任何潜在问题。
  • 对服务器的 SSH 访问(或者如果您在桌面上,则只需打开终端)。
  • 一种 non-root sudo user或访问 root user. 我们建议充当 non-root sudo user,但是,如果您在充当 root 时不小心,可能会损害您的系统。

在 CentOS 6 上安装 Mtop(MySQL 数据库服务器监控)

第 1 步。首先,让我们首先确保您的系统是最新的。

sudo yum update
sudo yum install epel-release

步骤 2. 在您的 Centos 系统上启用 RPMForge 存储库。

现在启用 Linux 机器下的 RPMForge 存储库以下载并安装最新版本的 MTOP 程序。

## RHEL/CentOS 6 32-Bit ##

wget https://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.i686.rpm

## RHEL/CentOS 6 64-Bit ##

wget https://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

步骤 3. 在 CentOS 6 上安装 Mtop。

使用安装 Mtop yum命令:

sudo yum install mtop

步骤 4. 启动 Mtop。

要启动 Mtop 程序,您需要使用以下命令连接到 MySQL 服务器:

# mysql -u root -p

mysql> grant super, reload, process on *.* to mysqltop;
Query OK, 0 rows affected (0.00 sec)

mysql> grant super, reload, process on *.* to mysqltop@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye

步骤 5. 在 CentOS 6 中运行 Mtop。

mtop

Mtop用法和功能键:

s – change the number of seconds to delay between updates
m – toggle manual refresh mode on/off
d – filter display with regular expression (user/host/db/command/state/info)
F – fold/unfold column names in select statement display
h – display process for only one host
u – display process for only one user
i – toggle all/non-Sleeping process display
o – reverse the sort order
q – quit
? – hel

恭喜! 您已成功安装 Mtop。 感谢您使用本教程在 CentOS 6 系统上安装 Mtop(MySQL 数据库服务器监控)。 如需其他帮助或有用信息,我们建议您查看 Mtop官方网站.

Save

Save