Get the App
SLTechnology News&Howtos  ›  Database  › 

How to set the size of redo log in MySQL

Shulou Source: shulou.com Published: 2022-05-31 20:44:39 10月03日 Update

Today, I will talk to you about how to set the size of redo log in MySQL. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

1. View the current redo log size

Mysql > show variables like 'innodb_log%' +-- +-+ | Variable_name | Value | +-+-+ | innodb_log_buffer_size | 16777216 | | innodb_log_checksums | ON | | innodb_log_compressed_pages | ON | | innodb_log_file_size | 50331648 | | innodb_log_files_in_group | 2 | innodb_log_group_home_dir |. / | | innodb_log_write_ahead_size | 8192 | +-+-+ |

The current size is 50331648, 1024/1024=48MB

2. Calculate the amount of redo log per minute

Mysql > pager grep-I "Log sequence number"; PAGER set to'grep-I "Log sequence number" 'mysql > show engine innodb status\ G select sleep (60); show engine innodb status\ GLog sequence number 49516471 row in set (0.01 sec) 1 row in set (1 min 0.00 sec) Log sequence number 50461501 row in set (0.00 sec)

During this 60s, our business system is in a normal running state. This time, for the experimental environment, I have done a simple business simulation operation.

Lsn increased from 4951647 to 5046150

Quantity of redo log per minute: round ((5046150-4951647) / 1024) = 92KB

Quantity of redo log per hour: 92K x 60=5520KB

Normally, the database switches redo log every 10 minutes, so for this database, a single redo log size 5520KB / 6=920KB

Because this database is a test platform and the volume of business is small, normally the single redo log size of the production database is between 200M-2G.

3. Edit the my.cnf file and restart the database to take effect

Innodb_log_file_size=200M after reading the above, do you have any further understanding of how to set the size of redo log in MySQL? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Size data database business content single business volume between hours platforms documents more status environment knowledge articles systems industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Information Xiaomi MySQL vpn