Real-time monitoring of MySQL using mytop under CentOS

Source: Internet
Author: User
Tags file permissions

Real-time monitoring of MySQL using mytop under CentOSThe Mytop project page is:HTTP://JEREMY.ZAWODNY.COM/MYSQL/MYTOP/MYTOP Installation
$ yum -y install mytop #epel源
Mytop Command Parameters
 $ man mytop-u/--user <username>: Specify USERNAME, Preset is root-p/--pass/--password <PASSWO Rd>: Specify password, preset is none-h/--host  

Note: Because .mytop there is a password for MySQL server, please note the file permissions.

Use of Mytop
    • Command line Run

$ mytop -uroot -pmysql -d wordpress -h 127.0.0.1
    • Running through a configuration file

mytop config file in ~/.mytop , also available in

$ vim ~/.mytopuser=rootpass=mysqlhost=localhostdb=wordpressdelay=5port=3306socket=/var/lib/mysql//mysql.sockbatchmode=0header=1color=1idle=1

Note: The socket setting is the same as the path in MY.CNF, General Mytop and MySQL are on the same machine.

    • Mytop Remote Monitoring

If you install Mytop on another machine, you need to set permissions on the MySQL server to remotely monitor

Add an account to MySQL server and give it process permissions

$ mysql -u root -pmysql> grant process on *.* to <REMOTE_USERNAME>@<REMOTE_IP> identified by ‘<PASSWORD>‘;mysql> flush privileges;mysql> exit

On the machine where mytop is installed, 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 ~/.mytopuser=<REMOTE_USERNAME>pass=<PASSWORD>host=<MYSQL_SERVER_IP>
    • Mytop shortcut keys

s:设定更新时间 p:暂停画面更新q:离开u:只看某个使用者的threado:反转排列顺序
    • Monitoring Screen parameter interpretation

The Mytop and Linux top commands show similar results, showing the current state of each thread and dynamic changes.

$ mytop-uroot-pmysql-d wordpress-h 127.0.0.1MySQL on 127.0.0.1 (5.6.29-log)                                      ,         &NB Sp  up 0+05:44:42 [16:51:31] queries:654.0  qps:    0 Slow:     0.0       &NBSP ; Se/in/up/de (%):    00/00/00/00             QPS now:    0 Slow qps:0.0   threads:    1 (  1/  0) 00/00/00/00 Key efficiency:100.0%  bps in/out:   0.8/160.4   Now In/out:   9.7/2.0k      id      user         HOST/IP & nbsp        DB      time    cmd Query or state                                      ,         &N Bsp                           ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp     --     ----       -------       --     ----   -------------                      &NBSP ;                          ,         &NB Sp                          ,         &NB Sp;                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp;8      root       localhost  wordpress         0  query Sho W Full processlist
  • The first line shows the host name, and the running time (in format) of MySQL to date days hour:minutes:seconds .

  • The second to third line shows the QPS: Requests per second, Slow: number of slow queries, Se/in/up/de (%): Read and write ratios.

  • The key efficiency in line four is the MyISAM buffer usage ratio (cache hit rate), Bps: The current network in and out of traffic.

  • The bottom-most area is the individual threads that are currently linked to the database, and you can press to k kill a thread, or by f knowing the information for a particular thread.




From for notes (Wiz)



Real-time monitoring of MySQL using mytop under CentOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.