温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

MySQL管理之道-笔记-MySQL5.7-在线调整innodb_buffer_pool_size

发布时间:2020-05-29 11:06:05 来源:网络 阅读:3051 作者:aix6180 栏目:MySQL数据库

在线调整innodb_buffer_pool_size不用重启mysql进程
MySQL5.7以前,调整innodb_buffer_pool_size需要重启mysql进程才可以生效。
建议业务低峰时间执行

1 当前大小128M

root@localhost:mysql3306.sock [(none)]>show variables like '%innodb_buffer_pool_size%';
+-------------------------+-----------+
| Variable_name           | Value     |
+-------------------------+-----------+
| innodb_buffer_pool_size | 134217728 |
+-------------------------+-----------+
row in set (0.03 sec)

root@localhost:mysql3306.sock [(none)]>select 134217728/1024/1024;  
+---------------------+
| 134217728/1024/1024 |
+---------------------+
|        128.00000000 |
+---------------------+
row in set (0.00 sec)

2 动态调整为256M

root@localhost:mysql3306.sock [(none)]>set global innodb_buffer_pool_size = 256*1024*1024;
Query OK, 0 rows affected (0.18 sec)

root@localhost:mysql3306.sock [(none)]>show variables like '%innodb_buffer_pool_size%';
+-------------------------+-----------+
| Variable_name           | Value     |
+-------------------------+-----------+
| innodb_buffer_pool_size | 268435456 |
+-------------------------+-----------+
row in set (0.02 sec)

root@localhost:mysql3306.sock [(none)]>select 268435456/1024/1024;
+---------------------+
| 268435456/1024/1024 |
+---------------------+
|        256.00000000 |
+---------------------+
row in set (0.00 sec)

root@localhost:mysql3306.sock [(none)]>select version();
+------------+
| version()  |
+------------+
| 5.7.18-log |
+------------+
row in set (0.03 sec)

调整时,内部会把数据页移动到一个新的位置,单位是块。如果想提升移动速度,则需要调整
innodb_buffer_pool_chunk_size的参数大小,默认是128M

innodb_buffer_pool_size/innodb_buffer_pool_instances = innodb_buffer_pool_chunk_size的参数大小,默认是128M

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI