mysql5.6-buffer pool 预热

参考:http://dev.mysql.com/doc/refman/5.6/en/innodb-preload-buffer-pool.html


背景

实现方式:mysql通过保存buffer pool中的page的tablespaceid和pageid到磁盘来保存buffer pool的状态。这些数据保存在名为ib_buffer_pool的文件中,而ib_buffer_pool保存在innodb data directory中。数据文件的名字也可以通过修改参数innodb_buffer_pool_filename来修改。


一、有两种方式dump buffer pool状态:


1、shutdown的时候。在shutdown之前需要设置一下全局变量,如下:

SET GLOBAL innodb_buffer_pool_dump_at_shutdown=ON;
2、server running的时候。在服务器还在运行的时候设置全局变量,如下:

SET GLOBAL innodb_buffer_pool_dump_now=ON;

二、同样,有两种方式load buffer pool状态:


1、server启动的时候。server启动的时候带上命令行选项,如下:

mysqld --innodb_buffer_pool_load_at_startup=ON;
2、server运行的时候。server运行的时候设置下全局变量,如下:

SET GLOBAL innodb_buffer_pool_load_now=ON;

三、也可以停止buffer pool 的 loading,设置如下:

SET GLOBAL innodb_buffer_pool_load_abort=ON;
四、监控buffer pool 的dump和load过程。

1、监视dump过程,可做如下设置:

SHOW STATUS LIKE 'Innodb_buffer_pool_dump_status';
或者

SELECT variable_value FROM information_schema.global_status WHERE
variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';

返回的结果有如下三种情况:

If the operation has not yet started, not started is returned. If the operation is complete, the completion time is printed (e.g. Finished at 110505 12:18:02). If the operation is in progress, status information is provided (e.g. Dumping buffer pool 5/7, page 237/2873).


2、监视load过程,可做如下设置:

SHOW STATUS LIKE 'Innodb_buffer_pool_load_status';
或者

SELECT variable_value FROM information_schema.global_status WHERE
variable_name = 'INNODB_BUFFER_POOL_LOAD_STATUS';
返回结果也有如下三种情况:

If the operation has not yet started, not started is returned. If the operation is complete, the completion time is printed (e.g.Finished at 110505 12:23:24). If the operation is in progress, status information is provided (e.g. Loaded 123/22301 pages).


五、mysql5.7.6开始,也可使用performance_schema来监控这两个过程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值