After the heat load data mysql 5.6

After the heat load data mysql 5.6

Transfer: http://blog.itpub.net/20892230/viewspace-2127469/

Symptom: After the database is restarted, happened to meet peak periods, the number of connections is full, causing the user to log have been waiting for, when the database is in an unresponsive state.

Failure Analysis: When the database is restarted, the hot data in the database buffer itself in the need to pre-innodb if buffer is too large, rely on themselves to innodb warm, there will be a very long period to achieve thermal data is required at this time. to disk to find, give the disk I / O to bring a lot of pressure. encounter a problem, we will have to wait, resulting in data unresponsive.

Solution: Before version 5.6, restart mysql, manually loads the data into the buffer inside to heat such as: select count (*) from table_name (heat data table);.

After 5.6 version, a new feature to provide rapid warm-up spool buffer_pool my.cnf added in several parameters which:. #Innodb_buffer_pool_load_at_startup = on off by default OFF. If enabled, when you start the service MySQL, MySQL will load the data into the local hot InnoDB buffer pool.
#innodb_buffer_pool_load_now = off off by default OFF. Manually loaded into the InnoDB buffer pool.
When #innodb_buffer_pool_filename = ib_buffer_pool If you turn InnoDB preheat function, stop the MySQL service, will save MySQL InnoDB buffer pool of hot data to the database root directory, the default file name ib_buffer_pool.
#innodb_buffer_pool_load_aborr default = OFF OFF OFF. If enabled, even if the opening function of the preheating InnoDB, MySQL nor will the local thermal load to the disk data InnoDB buffer pool. 
innodb_buffer_pool_dump_at_shutdown = on # default after 5.7.7 is on, the database is closed, the hot data flushed to disk
#innodb_buffer_pool_dump_now = off default to off, manually export the data to a disk hot innodb buffer pool;
#innodb_buffer_pool_dump_pct default = 40 OFF OFF. If this parameter is turned on, stop the MySQL service, InnoDB will save percentage InnoDB buffer pool of hot data to a local hard disk, 5.7.6 before beginning 100,5.7.7 is 25, which is 25% of the heat stored in the cache data .

Special note is innodb_buffer_pool_load_now innodb_buffer_pool_dump_now and these two parameters can be performed directly on the command line, the hot direct manual import and export data, according to the service environment to perform the custom innodb_buffer_pool_load_aborr may be performed directly in the suspension during execution;.
, Such as: set global innodb_buffer_pool_load_now = 1; - direct thermal loading data;
     SET = Global innodb_buffer_pool_load_aborr. 1; --- suspend loading;

Mysql when closed, will the memory of hot data stored in ib_buffer_pool file on disk, the file is located in the data directory.
PS: Only properly shut down mysql service, or pkill mysql, will export the data to disk hot machine. downtime or pkill -9 mysql, is not exported

Guess you like

Origin www.cnblogs.com/gered/p/11325584.html
Recommended