MySQL如何设置innodb_log_file_size
2022-03-13 21:04 abce 阅读(947) 评论(0) 编辑 收藏 举报1.查看pmm的“InnoDB Log File Usage Hourly”
2.查看pmm的“Inodb checkpoint age”
如果Uncheckpointed Bytes非常接近Max Checkpoint Age,就可以确定当前的innodb_log_file_size影响了性能。
3.在业务高峰期估算:
mysql> pager grep sequence
PAGER set to 'grep sequence'
mysql> show engine innodb statusG select sleep(60); show engine innodb statusG
Log sequence number 84 3836410803
1 row in set (0.06 sec)
1 row in set (1 min 0.00 sec)
Log sequence number 84 3838334638
1 row in set (0.05 sec)
mysql> select (3838334638 - 3836410803) / 1024 / 1024 as MB_per_min;
+------------+
| MB_per_min |
+------------+
| 1.83471203 |
+------------+
这里估算出来的是每分钟生成量,每小时大概是118MB,设置成2的倍数是128MB,因为有两组redo日志。所以设置成:
innodb_log_file_size=64M
4.业务高峰期执行估算:
mysql> show global status like 'Innodb_os_log_written';select sleep(60); show global status like 'Innodb_os_log_written';
原理和方法3类似。