Tag: Database observation div database LIS Check innodb admin monitor MySQL
Knowledge Point 16: MySQL monitoring (+)first, why use MySQL monitoring
With the continuous upgrading of software, the number of Myssql servers is more and more, and the probability of hardware and software failure is getting higher. This time need a set of monitoring system, when the host abnormal, at this time through the monitoring system discovery and processing.
This monitoring is actually after our development is completed, this time the software is running, this run we need to focus on the MySQL server is normal, then we need to observe it to provide some monitoring, this monitoring is when it fails,
Then our monitoring will tell us exactly where some of the anomalies or errors have occurred, and we can deal with them at this time.
second, the common classification of monitoring methods1. Write your own program or script control
More for the database is not much or the database itself is relatively small, then we can use this way.
steps:
1, monitor MySQL to provide normal service
- - -Hlocalhost Ping
If the result output: Mysqld is alive
2. Get several current status values for MySQL
- - -hlocalhost status
3. Get the current connection information for the database
- - -Hlocalhost processlist
4. Get the number of connections for the current database
- - - BNe "Select Host,countfromgroup by host;" Information_schema
5. Check, repair, analyze, optimize the related tables in MySQLServer
- - -- all-databases
on the MySQL connection client, execute the following command
1. Used to monitor whether MySQL uses temporary tables too much, if a temporary table is too large to be swapped out of memory to the disk file:
like ' created_tmp% ';
2. Lock status: Lock status including table and row locks, we can get the total number of locks through the system state variables, the number of times the lock causes other threads to wait, and lock the wait time information
like ' %lock% '
3.innodb_log_waits state variable directly reflects the number of waits due to insufficient Innodb log Buffer space
like ' innodb_log_waits ';
MySQL Advanced learning Note 16: MySQL Monitor! (Video serial Number: Advanced _35)