MySQL Operation and Troubleshooting Handbook
Contents
Overview ................................................................................................................................................... 1
Escalation Process ............................................................................ Error! Bookmark not defined.
Production Server Map ..................................................................... Error! Bookmark not defined.
MySQL Red Hat Cluster .................................................................................................................... 2
MySQL Replication .............................................................................................................................. 2
How to Set Up Replication ....................................................................................................... 2
Setting the Replication Master Configuration ......................................................... 3
Setting the Replication Slave Configuration............................................................ 5
Creating a Data Snapshot Using mysqldump ................................................................... 7
How to Backup MySQL ......................................................................................................................... 7
The backup_databases_send_mail.ksh Script ................................................................ 8
Executing the Script................................................................................................................. 10
Results From Script ............................................................................................................... 10
The Email Summary .................................................................................................................... 12
Troubleshooting MySQL .................................................................................................................. 13
Overview ............................................................................................................................................. 13
MySQL Script for Troubleshooting .................................................................................... 13
Results From Script ............................................................................................................... 14
Identifying Blocks and Locks ............................................................................................. 62
Who is Blocking a Query ..................................................................................................... 62
Who is Waiting on a Lock ................................................................................................... 62
Who is Locking Queries ........................................................................................................ 63
Overview
This document is intended to help identify the escalation process,
MySQL environment, how to start, stop, and failover the MySQL Red Hat
1
Cluster, how to configure and fix MySQL Replication, how to Backup and
Recover MySQL from a backup, and how to isolate problems.
Standard Unix commands should be used to identify bottlenecks, such as
top, iostat, mpstat, vmstat, and sar.
MySQL Red Hat Cluster
In order to start, stop, or failover the MySQL Cluster, use the Red
Hat Cluster commands as follows:
MySQL Replication
How to Set Up Replication
This section describes how to set up complete replication of a
MySQL server. There are a number of different methods for setting up
replication, and the exact method to use depends on how you are
setting up replication, and whether you already have data within your
master database.
There are some generic tasks that are common to all replication
setups:

On the master, you must enable binary logging and configure
a unique server ID. This might require a server restart.

On each slave that you want to connect to the master, you
must configure a unique server ID. This might require a
server restart

You may want to create a separate user that will be used by
your slaves to authenticate with the master to read the
binary log for replication. The step is optional.

Before creating a data snapshot or starting the replication
process, you should record the position of the binary log
on the master. You will need this information when
configuring the slave so that the slave knows where within
the binary log to start executing events.
If you already have data on your master and you want to use it to
synchronize your slave, you will need to create a data snapshot.
You can create a snapshot using mysqldump or by copying the data
files directly. Once you have configured the basic options, you
will need to follow the instructions for your replication.
2


setup. A number of alternatives are provided:

If you are establishing a new MySQL master and one or more
slaves, you need only set up the configuration, as you have
no data to exchange.

If you are already running a MySQL server, and therefore
already have data that must be transferred to your slaves
before replication starts.

If you are adding slaves to an existing replication
environment, you can set up the slaves without affecting
the master.
The easiest and most straight forward method for setting up
replication is to use new master and slave servers. You can also
use this method if you are setting up new servers but have an
existing dump of the databases from a different server that you
want to load into your replication configuration. By loading the
data into a new master, the data will be automatically replicated
to the slaves.
Setting the Replication Master Configuration

On a master, you must enable binary logging and establish a
unique server ID. If this has not already been done, this part of
master setup requires a server restart.

Each server within a replication group must be configured with a
unique server ID. This ID is used to identify individual servers
within the group, and must be a positive integer between 1 and
(232)–1. How you organize and select the numbers is entirely up
to you
Step 1:

To configure the binary log and server ID options, you will need
to shut down your MySQL server and edit the my.cnf file. Add the
following options to the configuration file within the [mysqld]
section.

[mysqld]
log-bin=mysql-bin
server-id=1

After making the changes, restart the server.
3

Ensure that the skip-networking option is not enabled on your
master. If networking has been disabled, your slave will not be
able to communicate with the master and replication will fail.
Step 2:

Each slave must connect to the master using a MySQL user name and
password, so there must be a user account on the master that the
slave can use to connect. Any account can be used for this
operation, providing it has been granted the REPLICATION SLAVE
privilege. You may wish to create a different account for each
slave, or connect to the master using the same account for each
slave.

You need not create an account specifically for replication.
However, you should be aware that the user name and password will
be stored in plain text within the master.info file. Therefore,
you may want to create a separate account that has privileges
only for the replication process, to minimize the possibility of
compromise to other accounts.

mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'slave_hostname'
IDENTIFIED BY ‘password’;
Step 3:

To configure replication on the slave you must determine
the master's current coordinates within its binary log. You will
need this information so that when the slave starts the
replication process, it is able to start processing events from
the binary log at the correct point.

To obtain the master binary log coordinates, follow these steps:
1. Start a session on the master by connecting to it with the commandline client, and flush all tables and block write statements by
executing the
FLUSH TABLES WITH READ LOCK statement:
mysql> FLUSH TABLES WITH READ LOCK;
For InnoDB tables, note that FLUSH TABLES WITH READ LOCK
also blocks COMMIT operations.
2.In a different session on the master, use the SHOW MASTER STATUS
statement to determine the current binary log file name and position:

mysql > SHOW MASTER STATUS;
+------------------------+-----------+--------------------+--------------------------+
| File
| Position
| Binlog_Do_DB
| Binlog_Ignore_DB
|
+------------------------+-----------+--------------------+--------------------------+
| mysql-bin.000003
| 73
|
|
4
|
+-------------------------+-----------+--------------------+--------------------------+

The File column shows the name of the log file and Position shows
the position within the file. You need them later when you are
setting up the slave. They represent the replication coordinates
at which the slave should begin processing new updates from the
master.

In the first session release the read lock:
mysql> UNLOCK TABLES;
If the master has been running previously without binary
logging enabled, the log file name and position values displayed by
SHOW MASTER STATUS will be empty.
You now have the information you need to enable the slave
to start reading from the binary log in the correct place to start
replication.
Setting the Replication Slave Configuration
Step 4:
On a replication slave, you must establish a unique server
ID. If this has not already been done, this part of slave setup
requires a server restart.

[mysqld]
server-id=2

After making the changes, restart the server.

If you are setting up multiple slaves, each one must have a
unique server-id value that differs from that of the master and
from each of the other slaves.

You do not have to enable binary logging on the slave for
replication to be enabled. However, if you enable binary logging
on the slave, you can use the binary log for data backups and
crash recovery on the slave, and also use the slave as part of a
more complex replication topology (for example, where the slave
acts as a master to other slaves).
Step 5:
To set up the slave to communicate with the master for
replication, you must tell the slave the necessary connection
information. To do this, execute the following statement on the slave,
replacing the option values with the actual values relevant to your
system:

mysql> CHANGE MASTER TO
5
MASTER_HOST='master_host_name',
MASTER_USER='replication_user_name',
MASTER_PASSWORD='replication_password',
MASTER_LOG_FILE='recorded_log_file_name',
MASTER_LOG_POS=recorded_log_position;

The MASTER_LOG_FILE and MASTER_LOG_POS values should be used
here which are obtained from Step 3.

The CHANGE MASTER TO statement has other options as well.
Step 6:

After that issue a command to start slave.
mysql> START SLAVE;

The above statement starts both sql thread and IO thread.

When a START SLAVE statement is issued on a slave server, the
slave creates an I/O thread, which connects to the master and
asks it to send the updates recorded in its binary logs.

The slave creates an SQL thread to read the relay log that is
written by the slave I/O thread and execute the events contained
therein.

To start or stop just SQL Thread use
mysql> START/STOP SLAVE SQL_THREAD;

To start or stop just SQL Thread use
mysql> START/STOP SLAVE IO_THREAD;
Step 7:

To see replication status use below command:
mysql> SHOW SLAVE STATUS\G
When setting up replication with existing data, you will need
to decide how best to get the data from the master to the slave before
starting the replication service.
1.If server_id and binary logging are not enabled on the master
you need to enable it and restart the server (see step 1).
2.If the MySQL master is running, create a user to be used by the
slave when connecting to the master during replication (see step 2).
6
Creating a Data Snapshot Using mysqldump

Start a session on the server by connecting to it with the
command-line client, and flush all tables and block write
statements by executing the FLUSH TABLES WITH READ LOCK
statement:
mysql> FLUSH TABLES WITH READ LOCK;

In another session, use mysqldump to create a dump either of all
the databases you want to replicate, or of selected individual
databases.

For example:
[shell]# mysqldump --all-databases --lock-all-tables >
dbdump.sql

Transfer the dump file to slave server.
[shell]# scp dbdump.sql slaveip:/<path>
password:

Obtain master status by using SHOW MASTER STATUS (see Step 3).

Update the configuration of the slave (see Step 4).

Import the dump file in slave:
[shell]# mysql < dbdump.sql

Configure the slave with the replication coordinates from the
master (see Step 5).

Start the slave threads (see Step 6).
How to Backup MySQL
When the database becomes too large it counterproductive to use
mysqldump. Therefore the backups for MySQL will use mysqlbackup.
The MySQL Backup will be accomplished using the MySQL Enterprise
Edition mysqlbackup executable and incorporated in a bash shell
script. The script is designed to email success or failure
information to Team Members.
7
The backup_databases_send_mail.ksh Script
Below is the backup_databases_send_mail.ksh script. The top part of
the script the variables are set, depending on the environment those
variables may need to be changed.
The script will be located in /apps/scripts/scripts
#!/bin/bash
#Stolen from Will Mayall and Marek Dohojda24-July-2013
#Mysql_DB_Backup_Script.ksh
dstr=`date +'%d.%m.%y.%H:%M'`
dstr1=`date +'%Y.%m.%d'`
export dstr1
#BACKUP_DIR=$dir/BACKUPS
MYSQL_DIR=/usr/bin
database_name=MY_DB
mysqlbackup="/opt/mysql/meb-3.7/bin/mysqlbackup"
user="backup"
password='MY_PASSWORD'
dir="/apps/full_backup"
date=`date +%m%d%Y`
HOSTNAME=`/bin/hostname`
export dstr HOME_DIR MYSQL_DIR SCRIPT_DIR BACKUP_DIR HOSTNAME date dir
BACKUP_LOG=LOGS/${dstr1}
export BACKUP_LOG
/bin/mkdir -p ${dir}/${BACKUP_LOG}
$mysqlbackup --defaults-file=/etc/my.cnf --user=$user -p${password} --backupdir=${dir}/${database_name}/${database_name}_backup_$date --socket=/var/lib/mysql/mysql.sock -port=3306 backup --compress 2> $dir/${BACKUP_LOG}/Error_${database_name}_DB_Backup${dstr1}.log
#find ${dir}/${database_name} -mtime +2 -exec rm -rf {} \;
if [ $(/bin/grep -c "error" $dir/${BACKUP_LOG}/Error_${database_name}_DB_Backup${dstr1}.log) -ne
0 ] ;then
8
/bin/echo -e "\n**************** ${database_name} MY_DB DataBase Backup Failed
************************************* \n"
>>$dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
/bin/echo -e "\t\t\tHost Name: ${HOSTNAME}\n\nDate&Time:$dstr1\t\tDatabase Name:
${database_name}\t\tEnvironment: MY_DB \n" >>
$dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
cat $dir/${BACKUP_LOG}/Error_${database_name}_DB_Backup${dstr1}.log >>
$dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
/bin/echo -e
"\n**********************************************************************************************
************ \n" >> $dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
( cat $dir/${BACKUP_LOG}//${database_name}_DB_Backup_Error_${dstr1}.log
# uuencode ${database_name}_DB_Backup_Error_${dstr1}.log
${database_name}_DB_Backup_Error_${dstr1}.log
) | mailx -s "ERROR While taking the backup on ${database_name} ${HOSTNAME} Server"
c_will.mayall@viasat.com
rm $dir/${BACKUP_LOG}/Error_${database_name}_DB_Backup${dstr1}.log
else
Backup_file_name=${dir}/${database_name}/${database_name}_backup_$date/datadir/*
/bin/echo -e "\n**************** ${HOSTNAME} MY_DB DataBase Backup Completed Sucessfully
***************************** \n" >>
$dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
/bin/echo -e "\t\t\tHost Name: ${HOSTNAME}\n\nDate&Time:$dstr1\t\tDatabase Name:
${database_name}\t\tEnvironment: ${HOSTNAME} \n" >>
$dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
cat $dir/${BACKUP_LOG}/Error_${database_name}_DB_Backup${dstr1}.log >>
$dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
/bin/echo -e "\nStatus:${database_name} ${HOSTNAME} Server Backup has been Completed
Sucessfully \n"
>> $dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
/bin/echo -e " ${database_name}_DataBase Backup File:" >>
$dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
du -h ${Backup_file_name} >>$dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
/bin/echo -e
"\n**********************************************************************************************
************ \n" >> $dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
( cat $dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
9
# uuencode ${database_name}_DB_Backup_Error_${dstr1}.log
${database_name}_DB_Backup_Error_${dstr1}.log
) | mailx -s " ${database_name} ${HOSTNAME} Server Backup has been Completed Sucessfully "
wamayall@yahoo.com,
rm $dir/${BACKUP_LOG}/Error_${database_name}_DB_Backup${dstr1}.log
fi
cat $dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log >>
$dir/${BACKUP_LOG}/DB_Backup_Log_File_${dstr1}.log
rm $dir/${BACKUP_LOG}/${database_name}_DB_Backup_Error_${dstr1}.log
Executing the Script
The current version of the script sets the Username and
Password within the script.
-bash-4.1$ ./backup_databases_send_mail.ksh
Results From Script
The results below get outputted to the screen, so when
executed from cron we will redirect to standard error.
IMPORTANT: Please check that mysqlbackup run completes successfully.
At the end of a successful 'backup' run mysqlbackup
prints "mysqlbackup completed OK!".
mysqlbackup: INFO: Unique generated backup id for this is 13748612908650052
mysqlbackup: INFO: Uses posix_fadvise() for performance optimization.
mysqlbackup: INFO: System tablespace file format is Antelope.
mysqlbackup: INFO: Found checkpoint at lsn 263249422.
mysqlbackup: INFO: Starting log scan from lsn 263249408.
mysqlbackup: INFO: Copying log...
mysqlbackup: INFO: Log copied, lsn 263249422.
We wait 1 second before starting copying the data files...
mysqlbackup: INFO: Copying /apps/mysql_data/ibdata1 (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/MY_DB/test.ibd (Antelope file format).
10
mysqlbackup: INFO: Copying /apps/mysql_data/MY_DB/radgroupcheck.ibd (Antelope file
format).
mysqlbackup: INFO: Copying /apps/mysql_data/MY_DB/radpostauth.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/MY_DB/wimax.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/MY_DB/radusergroup.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/MY_DB/nas.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/MY_DB/radippool.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/MY_DB/radgroupreply.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/MY_DB/radacct.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/mysql/slave_master_info.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/mysql/innodb_table_stats.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/mysql/slave_relay_log_info.ibd (Antelope file
format).
mysqlbackup: INFO: Copying /apps/mysql_data/mysql/innodb_index_stats.ibd (Antelope file format).
mysqlbackup: INFO: Copying /apps/mysql_data/mysql/slave_worker_info.ibd (Antelope file format).
mysqlbackup: INFO: Preparing to lock tables: Connected to mysqld server.
130726 17:54:54 mysqlbackup: INFO: Starting to lock all the tables....
130726 17:54:54 mysqlbackup: INFO: All tables are locked and flushed to disk
mysqlbackup: INFO: Opening backup source directory '/apps/mysql_data/'
130726 17:54:54 mysqlbackup: INFO: Starting to backup all files in subdirectories of
'/apps/mysql_data/'
mysqlbackup: INFO: Backing up the database directory 'mysql'
mysqlbackup: INFO: Backing up the database directory 'performance_schema'
mysqlbackup: INFO: Backing up the database directory 'MY_DB'
mysqlbackup: INFO: Backing up the database directory 'test'
mysqlbackup: INFO: Copying innodb data and logs during final stage ...
mysqlbackup: INFO: A copied database page was modified at 263249422.
(This is the highest lsn found on page)
Scanned log up to lsn 263254972.
Was able to parse the log up to lsn 263254972.
Maximum page number for a log record 412
mysqlbackup: INFO: Compressed 105 MB of data files to 7.4 MB (compression 92%).
130726 17:55:07 mysqlbackup: INFO: All tables unlocked
mysqlbackup: INFO: All MySQL tables were locked for 13.000 seconds
mysqlbackup: INFO: Full backup completed!
mysqlbackup: INFO: MySQL binlog position: filename mysqld-bin.000018, position 12953283
11
mysqlbackup: INFO: Backup created in directory '/apps/full_backup/MY_DB/MY_DB_backup_07262013'
------------------------------------------------------------Parameters Summary
------------------------------------------------------------Start LSN
: 263249408
End LSN
: 263254972
-------------------------------------------------------------
mysqlbackup completed OK!
The Email Summary
The below Summary will be emailed to the Team Members.
The output can be modified, if desired.
**************** mysqlaaa01.test.wdc1.wildblue.net MY_DB DataBase Backup Completed Sucessfully
*****************************
Host Name: test.net
Date&Time:2013.07.26
Database Name: MY_DB
Environment: mysqlaaa01.test.net
MySQL Enterprise Backup version 3.7.1 [2012/03/20]
Copyright (c) 2003, 2012, Oracle and/or its affiliates. All Rights Reserved.
INFO: Starting with following command line ...
/opt/mysql/meb-3.7/bin/mysqlbackup --defaults-file=/etc/my.cnf
--user=backup -pxxxxxxxx
--backup-dir=/apps/full_backup/MY_DB/MY_DB_backup_07262013
--socket=/var/lib/mysql/mysql.sock --port=3306 backup --compress
INFO: Got some server configuration information from running server.
-------------------------------------------------------------------Server Repository Options:
-------------------------------------------------------------------datadir
= /apps/mysql_data/
innodb_data_home_dir
=
innodb_data_file_path
= ibdata1:12M:autoextend
innodb_log_group_home_dir
= /apps/mysql_data/
innodb_log_files_in_group
= 2
innodb_log_file_size
= 50331648
-------------------------------------------------------------------Backup Config Options:
-------------------------------------------------------------------datadir
= /apps/full_backup/MY_DB/MY_DB_backup_07262013/datadir
innodb_data_home_dir
= /apps/full_backup/MY_DB/MY_DB_backup_07262013/datadir
innodb_data_file_path
= ibdata1:12M:autoextend
innodb_log_group_home_dir
= /apps/full_backup/MY_DB/MY_DB_backup_07262013/datadir
innodb_log_files_in_group
= 2
innodb_log_file_size
= 50331648
12
130726 17:50:40130726 17:50:40130726 17:50:41130726 17:50:42130726 17:50:42130726 17:50:42130726
17:50:43130726 17:50:43130726 17:50:43130726 17:50:43130726 17:50:43130726 17:50:43130726
17:50:43130726 17:50:43130726 17:50:43130726 17:50:43130726 17:50:43130726 17:50:53
Status:MY_DB mysqlaaa01.test.wdc1.wildblue.net Server Backup has been Completed Sucessfully
MY_DB_DataBase Backup File:
8.0K
/apps/full_backup/MY_DB/MY_DB_backup_07262013/datadir/ibbackup_logfile
1020K
/apps/full_backup/MY_DB/MY_DB_backup_07262013/datadir/ibdata1.ibz
1.3M
/apps/full_backup/MY_DB/MY_DB_backup_07262013/datadir/mysql
636K
/apps/full_backup/MY_DB/MY_DB_backup_07262013/datadir/performance_schema
1.2G
/apps/full_backup/MY_DB/MY_DB_backup_07262013/datadir/MY_DB
4.0K
/apps/full_backup/MY_DB/MY_DB_backup_07262013/datadir/test
*************************************************************************************************
*********
Troubleshooting MySQL
Overview
The scripts will be located in the /apps/scripts/scripts and
/apps/scripts/sql directories. The results will be in the
/apps/scripts/LOGS/$DATE directories. A good place to look for
problems is the error log, which can be found at:
/var/log/mysql/mysql.er
MySQL Script for Troubleshooting
#!/bin/bash
#Stolen from Will Mayall 25-July-2013
#Syntax ./run_all_scripts_with_logic.ksh
dstr1=`date +'%Y.%m.%d'`
export dstr1
HOME_DIR=/apps/scripts
export HOME_DIR
LOGS=$HOME_DIR/LOGS/${dstr1}
export LOGS
SCRIPT_DIR=$HOME_DIR/scripts
export SCRIPT_DIR
$SCRIPT_DIR/get_tuned_variables.ksh
$SCRIPT_DIR/get_engine_mutex_status.ksh
$SCRIPT_DIR/get_database_sizes.ksh
$SCRIPT_DIR/get_index_status.ksh
$SCRIPT_DIR/get_table_index_length.ksh
13
$SCRIPT_DIR/get_table_status.ksh
$SCRIPT_DIR/show_global_status.ksh
$SCRIPT_DIR/get_engine_status.ksh
cd $LOGS
cat *GET_DATABASE_SIZES_*.txt *GET_DATA_LENGTH_SIZES_*.txt *GET_ENGINE_STATUS_*.txt
*GET_TUNED_VARIABLES_*.txt *INDEX_STATUS_*.txt *SHOW_GLOBAL_STATUS_*.txt *TABLE_STATUS_*.txt >
$LOGS/GET_ALL_OUTPUT.txt
( cat $LOGS/GET_ALL_OUTPUT.txt
) | mailx -s "MY_DB Server Monitoring Output for $dstr1" wamayall@yahoo.com
/bin/rm $LOGS/GET_ALL_OUTPUT.txt
The above script sets the variables, then executes each
script and stores the output in
/apps/scripts/LOGS/$DATE, then sends email to the team
members with the results. Next I will examine the
Results.
Results From Script
I like to grab the MySQL Status as it is a Realtime
look at MySQL and contains useful information like the
version number, the character set, the Uptime, the
number of Threads running, the number of Slow queries
since the last flush status, the number of Open tables,
and the Queries per second.
-------------/usr/bin/mysql
Ver 14.14 Distrib 5.6.10, for Linux (x86_64) using
Connection id:
820
Current database:
Current user:
root@localhost
SSL:
Not in use
Current pager:
stdout
Using outfile:
''
14
EditLine wrapper
Using delimiter:
;
Server version:
Edition (Commercial)
5.6.10-enterprise-commercial-advanced MySQL Enterprise Server - Advanced
Protocol version:
10
Connection:
Localhost via UNIX socket
Server characterset:
latin1
Db
latin1
characterset:
Client characterset:
utf8
Conn.
utf8
characterset:
UNIX socket:
/var/lib/mysql/mysql.sock
Uptime:
76 days 22 hours 3 min 5 sec
Threads: 2 Questions: 4168288
Queries per second avg: 0.627
Slow queries: 21
Opens: 194
Flush tables: 1
Open tables: 102
--------------
Below shows the current sizes of the databases and the
next free extent. Innodb Tables Default next extent is
8MB, MyISAM next extent is the Operating Block Size.
+--------------------+----------------------+------------------+
| Data Base Name
| Data Base Size in MB | Free Space in MB |
+--------------------+----------------------+------------------+
| information_schema |
0.00976563 |
0.00000000 |
| mysql
|
0.76363182 |
0.00000000 |
| performance_schema |
0.00000000 |
0.00000000 |
| MY_DB
|
| TOTAL
3.70410156 |
|
4.00000000 |
4.47749901 |
4.00000000 |
+--------------------+----------------------+------------------+
--------------
I grab the Status again in the next script.
/usr/bin/mysql
Ver 14.14 Distrib 5.6.10, for Linux (x86_64) using
Connection id:
834
Current database:
15
EditLine wrapper
Current user:
root@localhost
SSL:
Not in use
Current pager:
stdout
Using outfile:
''
Using delimiter:
;
Server version:
Edition (Commercial)
5.6.10-enterprise-commercial-advanced MySQL Enterprise Server - Advanced
Protocol version:
10
Connection:
Localhost via UNIX socket
Server characterset:
latin1
Db
latin1
characterset:
Client characterset:
utf8
Conn.
utf8
characterset:
UNIX socket:
/var/lib/mysql/mysql.sock
Uptime:
76 days 22 hours 3 min 5 sec
Threads: 2 Questions: 4168337
Queries per second avg: 0.627
Slow queries: 21
Opens: 194
Flush tables: 1
Open tables: 102
--------------
Below are the Table and Index sizes in MB, the Engine
Type, and the number of rows per Table.
+--------------+---------------+--------+---------------+---------------------+------------+
| table_schema | table_name
| engine | total_size_mb | total_index_size_mb | table_rows |
+--------------+---------------+--------+---------------+---------------------+------------+
| MY_DB
| cui
| MyISAM |
0.00 |
0.00 |
0 |
| MY_DB
| nas
| InnoDB |
0.02 |
0.02 |
0 |
| MY_DB
| radacct
| InnoDB |
0.02 |
0.13 |
0 |
| MY_DB
| radcheck
| InnoDB |
0.14 |
0.14 |
2037 |
| MY_DB
| radgroupcheck | InnoDB |
0.02 |
0.02 |
0 |
| MY_DB
| radgroupreply | InnoDB |
0.02 |
0.02 |
0 |
| MY_DB
| radippool
| InnoDB |
0.02 |
0.05 |
0 |
| MY_DB
| radpostauth
| InnoDB |
0.02 |
0.00 |
0 |
| MY_DB
| radreply
| InnoDB |
1.52 |
1.52 |
18099 |
| MY_DB
| radusergroup
| InnoDB |
0.02 |
0.02 |
0 |
| MY_DB
| wimax
| InnoDB |
0.02 |
0.03 |
0 |
16
+--------------+---------------+--------+---------------+---------------------+------------+
--------------
Below are the current Mutually Exclusive Locks (MUTEX).
The ones with the largest number are the ones MySQL is
spending most of its time on. It displays the C code
it is working on, you can google the C code, like
lock0lock.cc:608 is working near line 608 of
lock0lock.c.
show engine innodb mutex
--------------
+--------+-------------------------+----------------+
| Type
| Name
| Status
|
+--------+-------------------------+----------------+
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=11
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=12
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=7
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=12
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=18
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
17
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=8
|
| InnoDB | trx0rseg.cc:196
| os_waits=11
|
| InnoDB | trx0rseg.cc:196
| os_waits=10
|
| InnoDB | trx0rseg.cc:196
| os_waits=10
|
| InnoDB | trx0rseg.cc:196
| os_waits=6
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=6
|
| InnoDB | trx0rseg.cc:196
| os_waits=18
|
| InnoDB | trx0rseg.cc:196
| os_waits=8
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=7
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=9
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=23
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=21
|
| InnoDB | trx0rseg.cc:196
| os_waits=11
|
| InnoDB | trx0rseg.cc:196
| os_waits=20
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=18
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=18
|
| InnoDB | trx0rseg.cc:196
| os_waits=10
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=18
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=9
|
18
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=10
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=9
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=10
|
| InnoDB | trx0rseg.cc:196
| os_waits=12
|
| InnoDB | trx0rseg.cc:196
| os_waits=11
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=9
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=18
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=23
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=22
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=20
|
| InnoDB | trx0rseg.cc:196
| os_waits=12
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=20
|
| InnoDB | trx0rseg.cc:196
| os_waits=21
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=20
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
19
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=12
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=12
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=15
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=17
|
| InnoDB | trx0rseg.cc:196
| os_waits=12
|
| InnoDB | trx0rseg.cc:196
| os_waits=20
|
| InnoDB | trx0rseg.cc:196
| os_waits=16
|
| InnoDB | trx0rseg.cc:196
| os_waits=18
|
| InnoDB | trx0rseg.cc:196
| os_waits=13
|
| InnoDB | trx0rseg.cc:196
| os_waits=19
|
| InnoDB | trx0rseg.cc:196
| os_waits=14
|
| InnoDB | trx0rseg.cc:196
| os_waits=22
|
| InnoDB | trx0rseg.cc:196
| os_waits=11
|
| InnoDB | trx0rseg.cc:196
| os_waits=21
|
| InnoDB | trx0rseg.cc:196
| os_waits=9
|
20
| InnoDB | ibuf0ibuf.cc:532
| os_waits=30758 |
| InnoDB | dict0dict.cc:883
| os_waits=7
|
| InnoDB | buf0dblwr.cc:132
| os_waits=1
|
| InnoDB | trx0sys.cc:594
| os_waits=1
|
| InnoDB | lock0lock.cc:608
| os_waits=343
|
| InnoDB | log0log.cc:741
| os_waits=4
|
| InnoDB | log0log.cc:737
| os_waits=3831
|
| InnoDB | buf0buf.cc:1291
| os_waits=17
|
| InnoDB | buf0buf.cc:1243
| os_waits=23391 |
| InnoDB | fil0fil.cc:1662
| os_waits=206
|
| InnoDB | srv0srv.cc:936
| os_waits=2133
|
| InnoDB | combined buf0buf.cc:993 | os_waits=421
|
| InnoDB | dict0dict.cc:2341
| os_waits=34092 |
| InnoDB | dict0dict.cc:892
| os_waits=682
|
| InnoDB | log0log.cc:799
| os_waits=4735
|
| InnoDB | btr0sea.cc:173
| os_waits=2356
|
| InnoDB | hash0hash.cc:392
| os_waits=7
|
| InnoDB | hash0hash.cc:392
| os_waits=11
|
| InnoDB | hash0hash.cc:392
| os_waits=9
|
| InnoDB | hash0hash.cc:392
| os_waits=12
|
| InnoDB | hash0hash.cc:392
| os_waits=6
|
| InnoDB | hash0hash.cc:392
| os_waits=33
|
| InnoDB | hash0hash.cc:392
| os_waits=10
|
| InnoDB | hash0hash.cc:392
| os_waits=12
|
| InnoDB | hash0hash.cc:392
| os_waits=11
|
| InnoDB | hash0hash.cc:392
| os_waits=7
|
| InnoDB | hash0hash.cc:392
| os_waits=11
|
| InnoDB | hash0hash.cc:392
| os_waits=8
|
| InnoDB | hash0hash.cc:392
| os_waits=4
|
| InnoDB | hash0hash.cc:392
| os_waits=15
|
| InnoDB | hash0hash.cc:392
| os_waits=13
|
| InnoDB | hash0hash.cc:392
| os_waits=3
|
| InnoDB | combined buf0buf.cc:994 | os_waits=17754 |
+--------+-------------------------+----------------+
--------------
21
Below is another MySQL Status.
/usr/bin/mysql
Ver 14.14 Distrib 5.6.10, for Linux (x86_64) using
Connection id:
EditLine wrapper
838
Current database:
Current user:
root@localhost
SSL:
Not in use
Current pager:
stdout
Using outfile:
''
Using delimiter:
;
Server version:
Edition (Commercial)
5.6.10-enterprise-commercial-advanced MySQL Enterprise Server - Advanced
Protocol version:
10
Connection:
Localhost via UNIX socket
Server characterset:
latin1
Db
latin1
characterset:
Client characterset:
utf8
Conn.
utf8
characterset:
UNIX socket:
/var/lib/mysql/mysql.sock
Uptime:
76 days 22 hours 3 min 5 sec
Threads: 2 Questions: 4168357
Queries per second avg: 0.627
Slow queries: 21
Opens: 194
Flush tables: 1
Open tables: 102
--------------
Below I run a show engine innodb status\G then sleep
for 60 seconds and repeat the command. The output is
in Realtime, so you can get a sense of how MySQL is
operating over time. You can calculate the size of the
redo log size, find Foreign Key Errors, gauge Reads and
Writes, etc.
-------------show engine innodb status
--------------
22
*************************** 1. row ***************************
Type: InnoDB
Name:
Status:
=====================================
2013-07-25 20:21:46 7f2aac798700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 15 seconds
----------------BACKGROUND THREAD
----------------srv_master_thread loops: 23667 srv_active, 0 srv_shutdown, 6614618 srv_idle
srv_master_thread log flush and writes: 6638276
---------SEMAPHORES
---------OS WAIT ARRAY INFO: reservation count 125068
OS WAIT ARRAY INFO: signal count 610602
Mutex spin waits 803914, rounds 5005350, OS waits 63141
RW-shared spins 294685, rounds 3098751, OS waits 43461
RW-excl spins 21249, rounds 1634870, OS waits 16432
Spin rounds per wait: 6.23 mutex, 10.52 RW-shared, 76.94 RW-excl
-----------TRANSACTIONS
-----------Trx id counter 448476
Purge done for trx's n:o < 448475 undo n:o < 0 state: running but idle
History list length 2245
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 838, OS thread handle 0x7f2aac798700, query id 4168358 localhost root init
show engine innodb status
---TRANSACTION 448475, not started
MySQL thread id 817, OS thread handle 0x7f2aa6ab0700, query id 4168278
wdc1ossapid01.dev.wdc1.wildblue.net 10.67.160.21 MY_DB cleaning up
-------FILE I/O
23
-------I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] ,
ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
Pending flushes (fsync) log: 0; buffer pool: 0
307700 OS file reads, 1548668 OS file writes, 585050 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
------------------------------------INSERT BUFFER AND ADAPTIVE HASH INDEX
------------------------------------Ibuf: size 1, free list len 3078, seg size 3080, 67756 merges
merged operations:
insert 408010, delete mark 6559001, delete 17948
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 276707, node heap has 2 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
--LOG
--Log sequence number 4003666895
Log flushed up to
4003666895
Pages flushed up to 4003666895
Last checkpoint at
4003666895
0 pending log writes, 0 pending chkp writes
441364 log i/o's done, 0.00 log i/o's/second
----------------------
24
BUFFER POOL AND MEMORY
---------------------Total memory allocated 137363456; in additional pool allocated 0
Dictionary memory allocated 143774
Buffer pool size
8192
Free buffers
1024
Database pages
7166
Old database pages 2625
Modified db pages
0
Pending reads 0
Pending writes: LRU 0, flush list 0 single page 0
Pages made young 94471, not young 86361414
0.00 youngs/s, 0.00 non-youngs/s
Pages read 307559, created 124399, written 1033250
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 7166, unzip_LRU len: 0
I/O sum[15]:cur[0], unzip sum[0]:cur[0]
-------------ROW OPERATIONS
-------------0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Main thread process no. 4195, id 139821256550144, state: sleeping
Number of rows inserted 10576011, updated 0, deleted 10535001, read 31854453
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
---------------------------END OF INNODB MONITOR OUTPUT
============================
-------------select sleep(60)
--------------
sleep(60)
25
0
-------------show engine innodb status
--------------
*************************** 1. row ***************************
Type: InnoDB
Name:
Status:
=====================================
2013-07-25 20:22:46 7f2aac798700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 60 seconds
----------------BACKGROUND THREAD
----------------srv_master_thread loops: 23667 srv_active, 0 srv_shutdown, 6614677 srv_idle
srv_master_thread log flush and writes: 6638335
---------SEMAPHORES
---------OS WAIT ARRAY INFO: reservation count 125068
OS WAIT ARRAY INFO: signal count 610602
Mutex spin waits 803914, rounds 5005350, OS waits 63141
RW-shared spins 294685, rounds 3098751, OS waits 43461
RW-excl spins 21249, rounds 1634870, OS waits 16432
Spin rounds per wait: 6.23 mutex, 10.52 RW-shared, 76.94 RW-excl
-----------TRANSACTIONS
-----------Trx id counter 448476
Purge done for trx's n:o < 448475 undo n:o < 0 state: running but idle
History list length 2245
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 838, OS thread handle 0x7f2aac798700, query id 4168360 localhost root init
26
show engine innodb status
---TRANSACTION 448475, not started
MySQL thread id 817, OS thread handle 0x7f2aa6ab0700, query id 4168278
wdc1ossapid01.dev.wdc1.wildblue.net 10.67.160.21 MY_DB cleaning up
-------FILE I/O
-------I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] ,
ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
Pending flushes (fsync) log: 0; buffer pool: 0
307700 OS file reads, 1548668 OS file writes, 585050 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
------------------------------------INSERT BUFFER AND ADAPTIVE HASH INDEX
------------------------------------Ibuf: size 1, free list len 3078, seg size 3080, 67756 merges
merged operations:
insert 408010, delete mark 6559001, delete 17948
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 276707, node heap has 2 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
--LOG
--Log sequence number 4003666895
Log flushed up to
4003666895
27
Pages flushed up to 4003666895
Last checkpoint at
4003666895
0 pending log writes, 0 pending chkp writes
441364 log i/o's done, 0.00 log i/o's/second
---------------------BUFFER POOL AND MEMORY
---------------------Total memory allocated 137363456; in additional pool allocated 0
Dictionary memory allocated 143774
Buffer pool size
8192
Free buffers
1024
Database pages
7166
Old database pages 2625
Modified db pages
0
Pending reads 0
Pending writes: LRU 0, flush list 0 single page 0
Pages made young 94471, not young 86361414
0.00 youngs/s, 0.00 non-youngs/s
Pages read 307559, created 124399, written 1033250
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 7166, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
-------------ROW OPERATIONS
-------------0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Main thread process no. 4195, id 139821256550144, state: sleeping
Number of rows inserted 10576011, updated 0, deleted 10535001, read 31854453
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
---------------------------END OF INNODB MONITOR OUTPUT
============================
28
Below I get the variables that can have the “most” benefits when
Tuning MySQL.
-------------select * from information_schema.GLOBAL_VARIABLES where variable_name in ( 'binlog_cache_size',
'bulk_insert_buffer_size', 'character_set_client', 'character_set_connection',
'character_set_database', 'character_set_filesystem', 'character_set_results',
'character_set_server', 'character_set_system', 'collation_connection', 'collation_database',
'collation_server', 'init_connect', 'innodb_buffer_pool_size', 'innodb_flush_log_at_trx_commit',
'join_buffer_size', 'key_buffer_size', 'max_allowed_packet', 'max_heap_table_size',
'myisam_sort_buffer_size', 'query_cache_limit', 'query_cache_size', 'sort_buffer_size',
'thread_cache_size', 'tmp_table_size', 'tx_isolation') order by variable_name
--------------
+--------------------------------+-------------------+
| VARIABLE_NAME
| VARIABLE_VALUE
|
+--------------------------------+-------------------+
| BINLOG_CACHE_SIZE
| 32768
|
| BULK_INSERT_BUFFER_SIZE
| 8388608
|
| CHARACTER_SET_CLIENT
| latin1
|
| CHARACTER_SET_CONNECTION
| latin1
|
| CHARACTER_SET_DATABASE
| latin1
|
| CHARACTER_SET_FILESYSTEM
| binary
|
| CHARACTER_SET_RESULTS
| latin1
|
| CHARACTER_SET_SERVER
| latin1
|
| CHARACTER_SET_SYSTEM
| utf8
|
| COLLATION_CONNECTION
| latin1_swedish_ci |
| COLLATION_DATABASE
| latin1_swedish_ci |
| COLLATION_SERVER
| latin1_swedish_ci |
| INIT_CONNECT
|
|
| INNODB_BUFFER_POOL_SIZE
| 134217728
|
| INNODB_FLUSH_LOG_AT_TRX_COMMIT | 1
|
| JOIN_BUFFER_SIZE
| 262144
|
| KEY_BUFFER_SIZE
| 8388608
|
| MAX_ALLOWED_PACKET
| 4194304
|
| MAX_HEAP_TABLE_SIZE
| 16777216
|
| MYISAM_SORT_BUFFER_SIZE
| 8388608
|
| QUERY_CACHE_LIMIT
| 1048576
|
| QUERY_CACHE_SIZE
| 1048576
|
| SORT_BUFFER_SIZE
| 262144
|
| THREAD_CACHE_SIZE
| 9
|
29
| TMP_TABLE_SIZE
| 16777216
|
| TX_ISOLATION
| REPEATABLE-READ
|
+--------------------------------+-------------------+
Below is another Status.
-------------/usr/bin/mysql
Ver 14.14 Distrib 5.6.10, for Linux (x86_64) using
Connection id:
EditLine wrapper
821
Current database:
Current user:
root@localhost
SSL:
Not in use
Current pager:
stdout
Using outfile:
''
Using delimiter:
;
Server version:
Edition (Commercial)
5.6.10-enterprise-commercial-advanced MySQL Enterprise Server - Advanced
Protocol version:
10
Connection:
Localhost via UNIX socket
Server characterset:
latin1
Db
latin1
characterset:
Client characterset:
utf8
Conn.
utf8
characterset:
UNIX socket:
/var/lib/mysql/mysql.sock
Uptime:
76 days 22 hours 3 min 5 sec
Threads: 2 Questions: 4168294
Queries per second avg: 0.627
Slow queries: 21
Opens: 194
Flush tables: 1
Open tables: 102
--------------
Below is the results for the Index Status. On MyISAM table the
Comment section should be Blank, if the table becomes corrupt or
disabled, it will be displayed at the line:
Comment:
30
To enable or repair a MyISAM Table, you will need over twice as much
disk space as the *.MYD and *.MYI files. For InnoDB Tables, it is
just informational.
-------------show index from MY_DB.cui
--------------
*************************** 1. row ***************************
Table: cui
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: username
Collation: A
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 2. row ***************************
Table: cui
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 2
Column_name: clientipaddress
Collation: A
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 3. row ***************************
31
Table: cui
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 3
Column_name: callingstationid
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.nas
--------------
*************************** 1. row ***************************
Table: nas
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 2. row ***************************
Table: nas
Non_unique: 1
Key_name: nasname
Seq_in_index: 1
32
Column_name: nasname
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.radacct
--------------
*************************** 1. row ***************************
Table: radacct
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: radacctid
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 2. row ***************************
Table: radacct
Non_unique: 0
Key_name: acctuniqueid
Seq_in_index: 1
Column_name: acctuniqueid
Collation: A
Cardinality: 0
Sub_part: NULL
33
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 3. row ***************************
Table: radacct
Non_unique: 1
Key_name: username
Seq_in_index: 1
Column_name: username
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 4. row ***************************
Table: radacct
Non_unique: 1
Key_name: framedipaddress
Seq_in_index: 1
Column_name: framedipaddress
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 5. row ***************************
Table: radacct
Non_unique: 1
34
Key_name: acctsessionid
Seq_in_index: 1
Column_name: acctsessionid
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 6. row ***************************
Table: radacct
Non_unique: 1
Key_name: acctsessiontime
Seq_in_index: 1
Column_name: acctsessiontime
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null: YES
Index_type: BTREE
Comment:
Index_comment:
*************************** 7. row ***************************
Table: radacct
Non_unique: 1
Key_name: acctstarttime
Seq_in_index: 1
Column_name: acctstarttime
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null: YES
35
Index_type: BTREE
Comment:
Index_comment:
*************************** 8. row ***************************
Table: radacct
Non_unique: 1
Key_name: acctstoptime
Seq_in_index: 1
Column_name: acctstoptime
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null: YES
Index_type: BTREE
Comment:
Index_comment:
*************************** 9. row ***************************
Table: radacct
Non_unique: 1
Key_name: nasipaddress
Seq_in_index: 1
Column_name: nasipaddress
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.radcheck
--------------
*************************** 1. row ***************************
36
Table: radcheck
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 2037
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 2. row ***************************
Table: radcheck
Non_unique: 1
Key_name: username
Seq_in_index: 1
Column_name: username
Collation: A
Cardinality: 2037
Sub_part: 32
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.radgroupcheck
--------------
*************************** 1. row ***************************
Table: radgroupcheck
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
37
Column_name: id
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 2. row ***************************
Table: radgroupcheck
Non_unique: 1
Key_name: groupname
Seq_in_index: 1
Column_name: groupname
Collation: A
Cardinality: 0
Sub_part: 32
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.radgroupreply
--------------
*************************** 1. row ***************************
Table: radgroupreply
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 0
Sub_part: NULL
38
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 2. row ***************************
Table: radgroupreply
Non_unique: 1
Key_name: groupname
Seq_in_index: 1
Column_name: groupname
Collation: A
Cardinality: 0
Sub_part: 32
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.radippool
--------------
*************************** 1. row ***************************
Table: radippool
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
39
Index_comment:
*************************** 2. row ***************************
Table: radippool
Non_unique: 1
Key_name: radippool_poolname_expire
Seq_in_index: 1
Column_name: pool_name
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 3. row ***************************
Table: radippool
Non_unique: 1
Key_name: radippool_poolname_expire
Seq_in_index: 2
Column_name: expiry_time
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null: YES
Index_type: BTREE
Comment:
Index_comment:
*************************** 4. row ***************************
Table: radippool
Non_unique: 1
Key_name: framedipaddress
Seq_in_index: 1
Column_name: framedipaddress
Collation: A
40
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 5. row ***************************
Table: radippool
Non_unique: 1
Key_name: radippool_nasip_poolkey_ipaddress
Seq_in_index: 1
Column_name: nasipaddress
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 6. row ***************************
Table: radippool
Non_unique: 1
Key_name: radippool_nasip_poolkey_ipaddress
Seq_in_index: 2
Column_name: pool_key
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 7. row ***************************
41
Table: radippool
Non_unique: 1
Key_name: radippool_nasip_poolkey_ipaddress
Seq_in_index: 3
Column_name: framedipaddress
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.radpostauth
--------------
*************************** 1. row ***************************
Table: radpostauth
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.radreply
--------------
*************************** 1. row ***************************
42
Table: radreply
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 18099
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 2. row ***************************
Table: radreply
Non_unique: 1
Key_name: username
Seq_in_index: 1
Column_name: username
Collation: A
Cardinality: 6033
Sub_part: 32
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.radusergroup
--------------
*************************** 1. row ***************************
Table: radusergroup
Non_unique: 1
Key_name: username
Seq_in_index: 1
43
Column_name: username
Collation: A
Cardinality: 0
Sub_part: 32
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
-------------show index from MY_DB.wimax
--------------
*************************** 1. row ***************************
Table: wimax
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 2. row ***************************
Table: wimax
Non_unique: 1
Key_name: username
Seq_in_index: 1
Column_name: username
Collation: A
Cardinality: 0
Sub_part: NULL
44
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 3. row ***************************
Table: wimax
Non_unique: 1
Key_name: spi
Seq_in_index: 1
Column_name: spi
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Below is the results of the “show global status;” command. Here is so
much information on how MySQL is performing in Realtime. You can use
these Values to calculate the Hit Rates of MySQL.
+-----------------------------------------------+-------------+
| Variable_name
| Value
|
+-----------------------------------------------+-------------+
| Aborted_clients
| 186
|
| Aborted_connects
| 40
|
| Binlog_cache_disk_use
| 0
|
| Binlog_cache_use
| 0
|
| Binlog_stmt_cache_disk_use
| 0
|
| Binlog_stmt_cache_use
| 0
|
| Bytes_received
| 842259430
|
| Bytes_sent
| 237575421
|
| Com_admin_commands
| 0
|
| Com_assign_to_keycache
| 0
|
45
| Com_alter_db
| 0
|
| Com_alter_db_upgrade
| 0
|
| Com_alter_event
| 0
|
| Com_alter_function
| 0
|
| Com_alter_procedure
| 0
|
| Com_alter_server
| 0
|
| Com_alter_table
| 0
|
| Com_alter_tablespace
| 0
|
| Com_alter_user
| 0
|
| Com_analyze
| 11
|
| Com_begin
| 0
|
| Com_binlog
| 0
|
| Com_call_procedure
| 0
|
| Com_change_db
| 389
|
| Com_change_master
| 0
|
| Com_check
| 0
|
| Com_checksum
| 0
|
| Com_commit
| 414780
|
| Com_create_db
| 1
|
| Com_create_event
| 0
|
| Com_create_function
| 0
|
| Com_create_index
| 0
|
| Com_create_procedure
| 0
|
| Com_create_server
| 0
|
| Com_create_table
| 11
|
| Com_create_trigger
| 0
|
| Com_create_udf
| 0
|
| Com_create_user
| 1
|
| Com_create_view
| 0
|
| Com_dealloc_sql
| 0
|
| Com_delete
| 1258
|
| Com_delete_multi
| 0
|
| Com_do
| 0
|
| Com_drop_db
| 0
|
| Com_drop_event
| 0
|
| Com_drop_function
| 0
|
46
| Com_drop_index
| 0
|
| Com_drop_procedure
| 0
|
| Com_drop_server
| 0
|
| Com_drop_table
| 0
|
| Com_drop_trigger
| 0
|
| Com_drop_user
| 0
|
| Com_drop_view
| 0
|
| Com_empty_query
| 0
|
| Com_execute_sql
| 0
|
| Com_flush
| 3
|
| Com_get_diagnostics
| 0
|
| Com_grant
| 8
|
| Com_ha_close
| 0
|
| Com_ha_open
| 0
|
| Com_ha_read
| 0
|
| Com_help
| 0
|
| Com_insert
| 828321
|
| Com_insert_select
| 0
|
| Com_install_plugin
| 0
|
| Com_kill
| 2
|
| Com_load
| 0
|
| Com_lock_tables
| 25
|
| Com_optimize
| 11
|
| Com_preload_keys
| 0
|
| Com_prepare_sql
| 0
|
| Com_purge
| 0
|
| Com_purge_before_date
| 0
|
| Com_release_savepoint
| 0
|
| Com_rename_table
| 0
|
| Com_rename_user
| 0
|
| Com_repair
| 0
|
| Com_replace
| 0
|
| Com_replace_select
| 0
|
| Com_reset
| 0
|
| Com_resignal
| 0
|
| Com_revoke
| 0
|
47
| Com_revoke_all
| 0
|
| Com_rollback
| 2143
|
| Com_rollback_to_savepoint
| 0
|
| Com_savepoint
| 0
|
| Com_select
| 2082384
|
| Com_set_option
| 835961
|
| Com_signal
| 0
|
| Com_show_binlog_events
| 0
|
| Com_show_binlogs
| 1
|
| Com_show_charsets
| 0
|
| Com_show_collations
| 159
|
| Com_show_create_db
| 0
|
| Com_show_create_event
| 0
|
| Com_show_create_func
| 0
|
| Com_show_create_proc
| 0
|
| Com_show_create_table
| 277
|
| Com_show_create_trigger
| 0
|
| Com_show_databases
| 41
|
| Com_show_engine_logs
| 0
|
| Com_show_engine_mutex
| 2
|
| Com_show_engine_status
| 42
|
| Com_show_events
| 0
|
| Com_show_errors
| 0
|
| Com_show_fields
| 626
|
| Com_show_function_code
| 0
|
| Com_show_function_status
| 3
|
| Com_show_grants
| 0
|
| Com_show_keys
| 220
|
| Com_show_master_status
| 1
|
| Com_show_open_tables
| 0
|
| Com_show_plugins
| 0
|
| Com_show_privileges
| 0
|
| Com_show_procedure_code
| 0
|
| Com_show_procedure_status
| 3
|
| Com_show_processlist
| 6
|
| Com_show_profile
| 0
|
48
| Com_show_profiles
| 0
|
| Com_show_relaylog_events
| 0
|
| Com_show_slave_hosts
| 0
|
| Com_show_slave_status
| 1
|
| Com_show_status
| 155
|
| Com_show_storage_engines
| 0
|
| Com_show_table_status
| 303
|
| Com_show_tables
| 65
|
| Com_show_triggers
| 275
|
| Com_show_variables
| 206
|
| Com_show_warnings
| 5
|
| Com_slave_start
| 0
|
| Com_slave_stop
| 0
|
| Com_stmt_close
| 0
|
| Com_stmt_execute
| 0
|
| Com_stmt_fetch
| 0
|
| Com_stmt_prepare
| 0
|
| Com_stmt_reprepare
| 0
|
| Com_stmt_reset
| 0
|
| Com_stmt_send_long_data
| 0
|
| Com_truncate
| 0
|
| Com_uninstall_plugin
| 0
|
| Com_unlock_tables
| 25
|
| Com_update
| 1
|
| Com_update_multi
| 0
|
| Com_xa_commit
| 0
|
| Com_xa_end
| 0
|
| Com_xa_prepare
| 0
|
| Com_xa_recover
| 0
|
| Com_xa_rollback
| 0
|
| Com_xa_start
| 0
|
| Compression
| OFF
|
| Connection_errors_accept
| 0
|
| Connection_errors_internal
| 0
|
| Connection_errors_max_connections
| 0
|
| Connection_errors_peer_address
| 0
|
49
| Connection_errors_select
| 0
|
| Connection_errors_tcpwrap
| 0
|
| Connections
| 838
|
| Created_tmp_disk_tables
| 1083
|
| Created_tmp_files
| 6
|
| Created_tmp_tables
| 4722
|
| Delayed_errors
| 0
|
| Delayed_insert_threads
| 0
|
| Delayed_writes
| 0
|
| Flush_commands
| 1
|
| Handler_commit
| 2077401
|
| Handler_delete
| 10535001
|
| Handler_discover
| 0
|
| Handler_external_lock
| 3325538
|
| Handler_mrr_init
| 0
|
| Handler_prepare
| 0
|
| Handler_read_first
| 766
|
| Handler_read_key
| 834268
|
| Handler_read_last
| 0
|
| Handler_read_next
| 20845740
|
| Handler_read_prev
| 0
|
| Handler_read_rnd
| 4431
|
| Handler_read_rnd_next
| 11083731
|
| Handler_rollback
| 2143
|
| Handler_savepoint
| 0
|
| Handler_savepoint_rollback
| 0
|
| Handler_update
| 4
|
| Handler_write
| 10650430
|
| Innodb_buffer_pool_dump_status
| not started |
| Innodb_buffer_pool_load_status
| not started |
| Innodb_buffer_pool_pages_data
| 7166
|
| Innodb_buffer_pool_bytes_data
| 117407744
|
| Innodb_buffer_pool_pages_dirty
| 0
|
| Innodb_buffer_pool_bytes_dirty
| 0
|
| Innodb_buffer_pool_pages_flushed
| 1003262
|
| Innodb_buffer_pool_pages_free
| 1024
|
50
| Innodb_buffer_pool_pages_misc
| 2
|
| Innodb_buffer_pool_pages_total
| 8192
|
| Innodb_buffer_pool_read_ahead_rnd
| 0
|
| Innodb_buffer_pool_read_ahead
| 87450
|
| Innodb_buffer_pool_read_ahead_evicted
| 531
|
| Innodb_buffer_pool_read_requests
| 371971757
|
| Innodb_buffer_pool_reads
| 154078
|
| Innodb_buffer_pool_wait_free
| 29988
|
| Innodb_buffer_pool_write_requests
| 147713435
|
| Innodb_data_fsyncs
| 585050
|
| Innodb_data_pending_fsyncs
| 0
|
| Innodb_data_pending_reads
| 0
|
| Innodb_data_pending_writes
| 0
|
| Innodb_data_read
| 5043212288
|
| Innodb_data_reads
| 307700
|
| Innodb_data_writes
| 1548668
|
| Innodb_data_written
| 38085512192 |
| Innodb_dblwr_pages_written
| 1033250
|
| Innodb_dblwr_writes
| 64089
|
| Innodb_have_atomic_builtins
| ON
|
| Innodb_log_waits
| 0
|
| Innodb_log_write_requests
| 9087995
|
| Innodb_log_writes
| 436562
|
| Innodb_os_log_fsyncs
| 441132
|
| Innodb_os_log_pending_fsyncs
| 0
|
| Innodb_os_log_pending_writes
| 0
|
| Innodb_os_log_written
| 4225520128
|
| Innodb_page_size
| 16384
|
| Innodb_pages_created
| 124399
|
| Innodb_pages_read
| 307559
|
| Innodb_pages_written
| 1033250
|
| Innodb_row_lock_current_waits
| 0
|
| Innodb_row_lock_time
| 0
|
| Innodb_row_lock_time_avg
| 0
|
| Innodb_row_lock_time_max
| 0
|
| Innodb_row_lock_waits
| 0
|
51
| Innodb_rows_deleted
| 10535001
|
| Innodb_rows_inserted
| 10576011
|
| Innodb_rows_read
| 31854453
|
| Innodb_rows_updated
| 0
|
| Innodb_num_open_files
| 18
|
| Innodb_truncated_status_writes
| 0
|
| Innodb_available_undo_logs
| 128
|
| Key_blocks_not_flushed
| 0
|
| Key_blocks_unused
| 6690
|
| Key_blocks_used
| 8
|
| Key_read_requests
| 72
|
| Key_reads
| 4
|
| Key_write_requests
| 31
|
| Key_writes
| 29
|
| Last_query_cost
| 0.000000
|
| Last_query_partial_plans
| 0
|
| Max_used_connections
| 20
|
| Not_flushed_delayed_rows
| 0
|
| Open_files
| 49
|
| Open_streams
| 0
|
| Open_table_definitions
| 91
|
| Open_tables
| 102
|
| Opened_files
| 4652
|
| Opened_table_definitions
| 154
|
| Opened_tables
| 194
|
| Performance_schema_accounts_lost
| 0
|
| Performance_schema_cond_classes_lost
| 0
|
| Performance_schema_cond_instances_lost
| 0
|
| Performance_schema_digest_lost
| 0
|
| Performance_schema_file_classes_lost
| 0
|
| Performance_schema_file_handles_lost
| 0
|
| Performance_schema_file_instances_lost
| 0
|
| Performance_schema_hosts_lost
| 0
|
| Performance_schema_locker_lost
| 0
|
| Performance_schema_mutex_classes_lost
| 0
|
| Performance_schema_mutex_instances_lost
| 0
|
52
| Performance_schema_rwlock_classes_lost
| 0
|
| Performance_schema_rwlock_instances_lost
| 0
|
| Performance_schema_session_connect_attrs_lost | 0
|
| Performance_schema_socket_classes_lost
| 0
|
| Performance_schema_socket_instances_lost
| 0
|
| Performance_schema_stage_classes_lost
| 0
|
| Performance_schema_statement_classes_lost
| 0
|
| Performance_schema_table_handles_lost
| 0
|
| Performance_schema_table_instances_lost
| 0
|
| Performance_schema_thread_classes_lost
| 0
|
| Performance_schema_thread_instances_lost
| 0
|
| Performance_schema_users_lost
| 0
|
| Prepared_stmt_count
| 0
|
| Qcache_free_blocks
| 1
|
| Qcache_free_memory
| 1031368
|
| Qcache_hits
| 0
|
| Qcache_inserts
| 0
|
| Qcache_lowmem_prunes
| 0
|
| Qcache_not_cached
| 2081837
|
| Qcache_queries_in_cache
| 0
|
| Qcache_total_blocks
| 1
|
| Queries
| 4168352
|
| Questions
| 4168218
|
| Rsa_public_key
|
|
| Select_full_join
| 75
|
| Select_full_range_join
| 0
|
| Select_range
| 0
|
| Select_range_check
| 0
|
| Select_scan
| 2498
|
| Slave_heartbeat_period
|
|
| Slave_last_heartbeat
|
|
| Slave_open_temp_tables
| 0
|
| Slave_received_heartbeats
|
|
| Slave_retried_transactions
|
|
| Slave_running
| OFF
|
| Slow_launch_threads
| 0
|
53
| Slow_queries
| 21
|
| Sort_merge_passes
| 0
|
| Sort_range
| 173
|
| Sort_rows
| 4430
|
| Sort_scan
| 194
|
| Ssl_accept_renegotiates
| 0
|
| Ssl_accepts
| 0
|
| Ssl_callback_cache_hits
| 0
|
| Ssl_cipher
|
|
| Ssl_cipher_list
|
|
| Ssl_client_connects
| 0
|
| Ssl_connect_renegotiates
| 0
|
| Ssl_ctx_verify_depth
| 0
|
| Ssl_ctx_verify_mode
| 0
|
| Ssl_default_timeout
| 0
|
| Ssl_finished_accepts
| 0
|
| Ssl_finished_connects
| 0
|
| Ssl_server_not_after
|
|
| Ssl_server_not_before
|
|
| Ssl_session_cache_hits
| 0
|
| Ssl_session_cache_misses
| 0
|
| Ssl_session_cache_mode
| NONE
|
| Ssl_session_cache_overflows
| 0
|
| Ssl_session_cache_size
| 0
|
| Ssl_session_cache_timeouts
| 0
|
| Ssl_sessions_reused
| 0
|
| Ssl_used_session_cache_entries
| 0
|
| Ssl_verify_depth
| 0
|
| Ssl_verify_mode
| 0
|
| Ssl_version
|
|
| Table_locks_immediate
| 1662759
|
| Table_locks_waited
| 0
|
| Table_open_cache_hits
| 1668215
|
| Table_open_cache_misses
| 163
|
| Table_open_cache_overflows
| 0
|
| Tc_log_max_pages_used
| 0
|
54
| Tc_log_page_size
| 0
|
| Tc_log_page_waits
| 0
|
| Threads_cached
| 7
|
| Threads_connected
| 2
|
| Threads_created
| 40
|
| Threads_running
| 1
|
| Uptime
| 6645785
|
| Uptime_since_flush_status
| 6645785
|
+-----------------------------------------------+-------------+
--------------
Below is the Status.
/usr/bin/mysql
Ver 14.14 Distrib 5.6.10, for Linux (x86_64) using
Connection id:
EditLine wrapper
836
Current database:
Current user:
root@localhost
SSL:
Not in use
Current pager:
stdout
Using outfile:
''
Using delimiter:
;
Server version:
Edition (Commercial)
5.6.10-enterprise-commercial-advanced MySQL Enterprise Server - Advanced
Protocol version:
10
Connection:
Localhost via UNIX socket
Server characterset:
latin1
Db
latin1
characterset:
Client characterset:
utf8
Conn.
utf8
characterset:
UNIX socket:
/var/lib/mysql/mysql.sock
Uptime:
76 days 22 hours 3 min 5 sec
Threads: 2 Questions: 4168348
Queries per second avg: 0.627
Slow queries: 21
--------------
55
Opens: 194
Flush tables: 1
Open tables: 102
Below is the Table Status. Here you can tell when a table was created
or modified, and on MyISAM you can tell when the Table has been
Analyzed/Optimized. Also, on MyISAM the Comment: column will be
Blank, if the Table becomes corrupt or disabled, it will be displayed
here. For InnoDB Tables the Create_time: will get updated on an
Analyze/Optimize if the table has changed.
-------------show table status from MY_DB
--------------
*************************** 1. row ***************************
Name: cui
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 0
Avg_row_length: 0
Data_length: 0
Max_data_length: 281474976710655
Index_length: 1024
Data_free: 0
Auto_increment: NULL
Create_time: 2013-05-09 23:33:24
Update_time: 2013-05-09 23:33:24
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 2. row ***************************
Name: nas
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
56
Data_length: 16384
Max_data_length: 0
Index_length: 16384
Data_free: 0
Auto_increment: 1
Create_time: 2013-07-20 02:00:02
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 3. row ***************************
Name: radacct
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 131072
Data_free: 0
Auto_increment: 1
Create_time: 2013-07-20 02:00:02
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 4. row ***************************
Name: radcheck
Engine: InnoDB
Version: 10
Row_format: Compact
57
Rows: 2037
Avg_row_length: 72
Data_length: 147456
Max_data_length: 0
Index_length: 147456
Data_free: 0
Auto_increment: 413857
Create_time: 2013-07-20 02:00:02
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 5. row ***************************
Name: radgroupcheck
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 16384
Data_free: 0
Auto_increment: 1
Create_time: 2013-07-20 02:00:02
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 6. row ***************************
Name: radgroupreply
Engine: InnoDB
58
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 16384
Data_free: 0
Auto_increment: 1
Create_time: 2013-07-20 02:00:02
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 7. row ***************************
Name: radippool
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 49152
Data_free: 0
Auto_increment: 1
Create_time: 2013-07-20 02:00:02
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 8. row ***************************
59
Name: radpostauth
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: 1
Create_time: 2013-07-20 02:00:02
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 9. row ***************************
Name: radreply
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 18099
Avg_row_length: 87
Data_length: 1589248
Max_data_length: 0
Index_length: 1589248
Data_free: 4194304
Auto_increment: 10141632
Create_time: 2013-07-20 02:00:03
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
60
Comment:
*************************** 10. row ***************************
Name: radusergroup
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 16384
Data_free: 0
Auto_increment: NULL
Create_time: 2013-07-20 02:00:03
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 11. row ***************************
Name: wimax
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 32768
Data_free: 0
Auto_increment: 1
Create_time: 2013-07-20 02:00:03
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
61
Checksum: NULL
Create_options:
Comment:
Identifying Blocks and Locks
Who is Blocking a Query
The following query will identify which User is blocking another query
and who is waiting on the block. MySQL will generally kill the
blocking query after 60 seconds, however sometimes the query must be
killed manually. Once you have identified the query causing the
block, use the mysql command “kill Id;” where Id is the p.id.
SELECT r.trx_id AS waiting_trx_id, r.trx_mysql_thread_id AS waiting_thread,
TIMESTAMPDIFF(SECOND, r.trx_wait_started, CURRENT_TIMESTAMP) AS wait_time,
r.trx_query AS waiting_query,
l.lock_table AS waiting_table_lock,
b.trx_id AS blocking_trx_id, b.trx_mysql_thread_id AS blocking_thread,
SUBSTRING(p.host, 1, INSTR(p.host, ':') - 1) AS blocking_host,
SUBSTRING(p.host, INSTR(p.host, ':') +1) AS blocking_port,
IF(p.command = "Sleep", p.time, 0) AS idle_in_trx,
b.trx_query AS blocking_query
FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS as w
INNER JOIN INFORMATION_SCHEMA.INNODB_TRX AS b ON b.trx_id = w.blocking_trx_id
INNER JOIN INFORMATION_SCHEMA.INNODB_TRX AS r ON r.trx_id = w.requesting_trx_id
INNER JOIN INFORMATION_SCHEMA.INNODB_LOCKS AS l ON w.requested_lock_id = l.lock_id
INNER JOIN INFORMATION_SCHEMA.PROCESSLIST AS p ON p.id = b.trx_mysql_thread_id
ORDER BY wait_time DESC\G
Who is Waiting on a Lock
The following query will display who is waiting on a lock.
there will be one query causing the other queries to wait.
SELECT r.trx_id waiting_trx_id,
r.trx_mysql_thread_id waiting_thread,
r.trx_query waiting_query,
b.trx_id blocking_trx_id,
b.trx_mysql_thread_id blocking_thread,
62
Generally
b.trx_query blocking_query
FROM
information_schema.innodb_lock_waits w
INNER JOIN information_schema.innodb_trx b
ON
b.trx_id = w.blocking_trx_id
INNER JOIN information_schema.innodb_trx r
ON
r.trx_id = w.requesting_trx_id;
Who is Locking Queries
The following query can be used to see which queries are holding locks
for excessive periods of time. You can set the Threshold to X many
seconds, say 30 seconds.
SET @threshold = 30;
SELECT p.user,
LEFT(p.HOST, LOCATE(':', p.HOST) - 1) host, p.id,
TIMESTAMPDIFF(SECOND, t.TRX_STARTED, NOW()) duration,
COUNT(DISTINCT ot.REQUESTING_TRX_ID) waiting
FROM INFORMATION_SCHEMA.INNODB_TRX t
JOIN INFORMATION_SCHEMA.PROCESSLIST p
ON ( p.ID = t.TRX_MYSQL_THREAD_ID )
LEFT JOIN INFORMATION_SCHEMA.INNODB_LOCK_WAITS ot
ON ( ot.BLOCKING_TRX_ID = t.TRX_id )
WHERE t.TRX_STARTED + INTERVAL @threshold SECOND <= NOW()
GROUP BY LEFT(p.HOST, LOCATE(':', p.HOST) - 1), p.id, duration
HAVING duration >= @threshold OR waiting > 0;
63