MySQL管理之道-筆記-MySQL5.7-在線調整innodb_buffer_pool_size

在線調整innodb_buffer_pool_size不用重啓mysql進程
MySQL5.7之前,調整innodb_buffer_pool_size須要重啓mysql進程才能夠生效。
建議業務低峯時間執行mysql

1 當前大小128Msql

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 動態調整爲256Mide

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的參數大小,默認是128Mcode

innodb_buffer_pool_size/innodb_buffer_pool_instances = innodb_buffer_pool_chunk_size的參數大小,默認是128M進程

相關文章
相關標籤/搜索