Mytop is a similar Linux under the Top command-style MySQL Monitoring Tools, Mytop Adopt Perl development. mytop can monitor MySQL 's current connection user and the commands being executed.
Mytop the project page is: http://jeremy.zawodny.com/mysql/mytop/
1. Mytopinstallation
Wget-o/etc/yum.repos.d/epel.repo Http://mirrors.aliyun.com/repo/epel-6.repo
yum-y Install mytop #epel Source
2. MytopCommand Parameters
-U or-user username
Username to use when logging in to the MySQL server. Default: ' Root '.
-P or-pass Or-password password
Password to use when logging in to the MySQL server. Default:none.
-H or-host hostname[:p ort]
Hostname of the MySQL server. The hostname is followed by an option port number.
Note that the port was specified separate from the host when using a config file.
Default: ' localhost '.
-port or-p Port
If you ' re running MySQL in a non-standard port, use this to specify the port number.
default:3306.
-S Or-delay seconds
How long between display refreshes. Default:5
-D or-db or-database Database
Use if you ' d like mytop to connect to a specific database by default. Default: ' Test '.
-S Or-socket/path/to/socket
If you're running mytop on the same host as MySQL, you may wish to has it use the MySQL
Socket directly rather than a standard TCP/IP connection. If you do,just specify one.
-B or-batch Or-batchmode
In batch mode, Mytop runs only once, does not clear the screens, and places no limit on
The number of lines it would print. This was suitable for running periodically (perhaps
From Cron) to capture the information-a file for later viewing. You might use batch
Mode in a CGI script to occasionally display your MySQL server status on the Web.
Default parameter Description:
* Database Specified "TEST" (Default is "test")
* Username Specified "root" (default is "root")
* Password Specified "123456" (Default is "")
* hostname specified "localhost" (default is "localhost")
* Port Specified "3306" (Default is 3306)
* Socket Specified "/data/3306/mysql.sock" (Default is "")
3. Mytopthe Use
Command line Run
[Email protected] ~]# mytop-uroot-p123456-s/data/3307/mysql.sock-d Liangkai
Hint: Show color description
Query-yellow
Sleep-white
Connect-green
4.running through a configuration file
Mytop configuration file in ~/.mytop, can also be in ~/.my.cnf Configure the user name and password in the file.
$ vim ~/.mytop
User=root
Pass=mysql
Host=localhost
Db=wordpress
Delay=5
port=3306
Socket=/var/lib/mysql//mysql.sock
Batchmode=0
Header=1
Color=1
Idle=1
Note : Socket Setting and my.cnf in the same way, the general Mytop and the Mysql on the same machine.
5. MytopRemote Monitoring
If you Mytop when mounted on a different machine, you need to set MySQL Server to remotely monitor the permissions on the
in the MySQL Server add an account to it and give it Process the Permissions
$ mysql-u Root-p
Mysql> Grant Process on * * to <REMOTE_USERNAME>@<REMOTE_IP> identified by ' <PASSWORD> ';
mysql> flush Privileges;
Mysql> exit
in the installation Mytop machine, specify or modify the configuration file settings with parameters.
parameter specifies
$ mytop-u <REMOTE_USERNAME>-P <PASSWORD>-H <MYSQL_SERVER_IP>
Modifying a configuration file
$ vim ~/.mytop
User=<remote_username>
Pass=<password>
Host=<mysql_server_ip>
6. Mytopshortcut Keys
s : Set update Time
P : Pause screen Update
Q : Leave
u : see only one user's Thread
o : Reverse sort order
7.Monitoring screen parameter interpretation
Mytop and the Linux the following Top the commands show similar results, and the following shows the current state of each thread and is a dynamic change.
The first line shows the host name, and so far MySQL The Run time ( in days hour:minutes:seconds format ) .
the second to third line shows the Qps: Requests per second, Slow: number of slow queries, se/in/up/de (%): Read and write ratio.
the fourth line of Key Efficiency is that Myisam Key-Value buffer usage ratio ( cache hit Ratio ) , Bps: Current network traffic.
The bottom area is the individual threads that are currently linked to the database, and you can press k Kill a thread, or press F understand the information for a particular thread.
Null
List of attachments
Mytop Monitoring Tools