MySQL monitoring tool-Innotop

Source: Internet
Author: User

MySQL monitoring tool-Innotop

Innotop is a powerful MySQL monitoring tool. It uses perl to show the running status of MysQL servers and Innodb in text mode.

Install innotop

: Https://github.com/innotop/innotop

Github provides two versions: The innotop-master and the innotop-gtid ). Here, we use the development version.

Note: the latest version of google code is 1.9.1, which is unavailable for many functions. It may be related to the MySQL version. We recommend that you download it directly from Github.

# Unzip innotop-master.zip

# Cd innotop-master

# Perl Makefile. PL

Checking if your kit is complete...Looks goodWarning: prerequisite Term::ReadKey 2.1 not found.Writing Makefile for innotop

The preceding error is reported. The ReadKey package is missing.

# Yum search ReadKey -- Note: Generally, all the missing Perl modules can be obtained by yum.

Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: CentOS.ustc.edu.cn * extras: centos.ustc.edu.cn * updates: centos.ustc.edu.cn================================================= N/S matched: ReadKey ==================================================perl-TermReadKey.x86_64 : A perl module for simple terminal control  Name and summary matches only, use "search all" for everything.

# Yum install-y perl-TermReadKey

# Perl Makefile. PL

Writing Makefile for innotop

# Make install

cp innotop blib/script/innotop/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/innotopManifying blib/man1/innotop.1Installing /usr/local/share/man/man1/innotop.1Installing /usr/local/bin/innotopAppending installation info to /usr/lib64/perl5/perllocal.pod

How to Use Innotop

First, we can use innotop -- help to view common startup parameters.

# innotop --helpUsage: innotop <options> <innodb-status-file>  --[no]color   -C   Use terminal coloring (default)  --config      -c   Config file to read  --count            Number of updates before exiting  --delay       -d   Delay between updates in seconds  --help             Show this help message  --host        -h   Connect to host  --[no]inc     -i   Measure incremental differences  --mode        -m   Operating mode to start in  --nonint      -n   Non-interactive, output tab-separated fields  --password    -p   Password to use for connection  --port        -P   Port number to use for connection  --skipcentral -s   Skip reading the central configuration file  --socket      -S   MySQL socket to use for connection  --spark            Length of status sparkline (default 10)  --timestamp   -t   Print timestamp in -n mode (1: per iter; 2: per line)  --user        -u   User for login if not current user  --version          Output version information and exit  --write       -w   Write running configuration into home directory if no config files were loaded

Where,

-D: How long is the Update Time?

-H: Connection Host Name

-P: connected Port

-S: socket location

-U: connected user

Familiar with MysQL is not hard to understand.

 

After logging in, the default Dashboard is used. Innotop supports multiple modes. Dashboard is only one of them. Pass "?" Key. We can view all modes.

The above letters can be switched to different States.

 

How to view innotop documents

1. # man innotop

2. # perldoc innotop

 

How to monitor multiple MySQL servers

There are two methods:

1. Add it directly on the innotop interactive interface as follows:

# Innotop

After entering the interactive interface, click @ to enter the connection configuration interface.

Enter the following items:

Description:

Choose connections for this mode: Select connection. If the connection does not exist, create it manually. So the following message is displayed: "There is no connection called 'master26', create it? :".

Enter "y" and press Enter. The system prompts you to enter the DSN string in the format.

Note that the cursor is not moved when you Enter the password, but it is actually input. after entering the password, press Enter directly.

This method is simple. It is applicable when there are few machines to monitor. However, the disadvantage of this method is that once innotop is exited, all configuration information will be lost and re-entered, you need to reconfigure it.

Therefore, the recommended method is as follows.

Ii. Use the configuration file

# Innotop -- write: Enter the interactive interface and exit. A. innotop/innotop. conf file is generated in the current directory.

# ls .innotop/innotop.conf  plugins

# Vim. innotop/innotop. conf

The configuration file contains the connection configuration information. By default, there is a localhost.

[connections]localhost=user= have_user= have_pass= dsn=DBI:mysql:;host=localhost;mysql_read_default_group=client savepass= dl_table=test.innotop_dl[/connections]

Of course, this is not very useful for editing our own configuration information and can be deleted.

Here, you can add a connection information according to the first method, and then edit it accordingly.

Take master26 In the first method as an example. After adding, the information in innotop. conf is as follows:

[connections]localhost=user= have_user= have_pass= dsn=DBI:mysql:;host=localhost;mysql_read_default_group=client savepass= dl_table=test.innotop_dlmaster26=user=root have_user=1 pass=123 have_pass=1 dsn=DBI:mysql:;host=192.168.91.26;port=3306 savepass=1[/connections]

Edit the innotop. conf file based on actual production requirements.

[connections]master26=user=root have_user=1 pass=123 have_pass=1 dsn=DBI:mysql:;host=192.168.91.26;port=3306 savepass=1slave25=user=root have_user=1 pass=123 have_pass=1 dsn=DBI:mysql:;host=192.168.91.25;port=3306 savepass=1slave22=user=root have_user=1 pass=123 have_pass=1 dsn=DBI:mysql:;host=192.168.91.22;port=3306 savepass=1[/connections]

Start innotop. master26 information is monitored by default.

You can use "n" or "@" to select the corresponding server.

Although it is good, it is not intuitive enough. We hope that the information of the three servers in this example can be displayed on one screen, so we do not need to switch back and forth, which is more intuitive. Here, you need to use the server groups function.

SERVER GROUPS

As the name suggests, it refers to grouping servers. The granularity of such information is not the server, but the whole group.

There are two ways to add:

1. directly add

Use the "#" key to first create the group name and then add the server, as shown below:

Ii. Edit the configuration file

[server_groups]master-slave=master26 slave22 slave25[/server_groups]

Next, let's take a look at the cluster Display Effect

It is sufficient to monitor the status of the master and slave clusters.

Note: After the configuration is completed in the innotop interactive interface, You need to exit innotop and enter again. Otherwise, the CXN column will not be displayed.

Summary:

1. There may be doubts about saving the password to the configuration file, especially in the production environment. In fact, the password can also not be saved in the configuration file. The configuration is as follows:

[connections]server144=user=root have_user=1 have_pass=1 dsn=DBI:mysql:;host=192.168.244.144;port=3306 savepass= dl_table=[/connections]

If it is added to the innotop interactive interface, the last step is Save password in plain text in the config file? : Write "n.

2. In addition to the above features, innotop is quite powerful. For example, in M mode, that is, in Replication Status, you can use the "o" key to send commands to the server. As follows:

Anyway and Innotop functions are still powerful ~

Refer:

Https://www.percona.com/blog/2013/10/14/innotop-real-time-advanced-investigation-tool-mysql/

This article permanently updates the link address:

Related Article

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.