According to the mysql documentation (Docs), in order to change innodb-log-file-size in step #4 I need to delete the binary logs. I have some concerns and questions about this. My current value for innodb-log-file-size is 5MB. So I would assume my binary log files are 5MB each (max). When I look at the bin-log directory I have a bunch of file names like 'mysql-bin.000001', 'mysql-bin.000002', etc. I believe these are the binary log files, but they are all quite a bit larger than 5MB. There are 2 files (ib_logfile0, ib_logfile1) that are 5 MB. So my question is
根据mysql文档(Docs),为了在步骤#4中更改innodb-log-file-size,我需要删除二进制日志。我对此有一些担忧和疑问。我对innodb-log-file-size的当前值是5MB。所以我假设我的二进制日志文件是每个5MB(最大)。当我查看bin-log目录时,我有一堆文件名,如'mysql-bin.000001','mysql-bin.000002'等。我相信这些是二进制日志文件,但它们都是相当的比特大于5MB。有2个文件(ib_logfile0,ib_logfile1)为5 MB。所以我的问题是
- Which of those files is my 'binary log'?
- Which of those do I need to delete?
哪些文件是我的“二进制日志”?
我需要删除哪些内容?
Thanks in advance
提前致谢
1 个解决方案
#1
9
The InnoDB log is in ib_logfile0 and ib_logfile1. These are the files sized by innodb_log_file_size
.
InnoDB日志位于ib_logfile0和ib_logfile1中。这些是innodb_log_file_size大小的文件。
To resize the InnoDB logs, you first need to shut down mysqld cleanly. That will make sure that any changes in the log have already been flushed into your tablespaces. The clean shutdown is important, because if you don't do this step, you have a high chance of losing data.
要调整InnoDB日志的大小,首先需要干净地关闭mysqld。这将确保日志中的任何更改都已刷新到您的表空间中。干净关闭很重要,因为如果不执行此步骤,则很有可能丢失数据。
After you have shut down mysqld cleanly, the ib_logfiles are superfluous. You must rm
them to change their size.
在你干净地关闭mysqld之后,ib_logfiles是多余的。你必须让他们改变他们的大小。
As you restart mysqld, InnoDB notices that the files are missing, and creates new file at the new size according to the innodb_log_file_size
variable in your my.cnf file. So make sure you edit that file before you restart, or else it'll just create new 5MB files.
当您重新启动mysqld时,InnoDB会注意到文件丢失,并根据my.cnf文件中的innodb_log_file_size变量以新大小创建新文件。因此,请确保在重新启动之前编辑该文件,否则它只会创建新的5MB文件。
MySQL 5.6 makes this process a little bit simpler. You don't need to rm
the log files, but you do need to restart mysqld to make a new log file size take effect. The way it works in 5.6 is that if the size of these files is different from the config variable, MySQL automatically does another clean restart (to make sure the files don't contain any changes that are unflushed), and then InnoDB resizes the files upon the final startup.
MySQL 5.6使这个过程更简单一些。您不需要rm日志文件,但您需要重新启动mysqld以使新的日志文件大小生效。它在5.6中的工作方式是,如果这些文件的大小与config变量不同,MySQL会自动执行另一次干净重启(以确保文件不包含任何未刷新的更改),然后InnoDB调整文件大小在最后的启动。
The other files (mysql-bin.000001, etc.) are binary logs. These may grow up to max_binlog_size
(which is 1GB by default), but the binary logs vary in size because new logs are created whenever you restart mysqld or execute FLUSH LOGS
. Anyway, they have nothing to do with the InnoDB logs.
其他文件(mysql-bin.000001等)是二进制日志。这些可能会增长到max_binlog_size(默认为1GB),但二进制日志的大小不同,因为每当您重新启动mysqld或执行FLUSH LOGS时都会创建新日志。无论如何,它们与InnoDB日志无关。
PS: You might like this article: How to calculate a good InnoDB log file size.
PS:你可能会喜欢这篇文章:如何计算一个好的InnoDB日志文件大小。
#1
9
The InnoDB log is in ib_logfile0 and ib_logfile1. These are the files sized by innodb_log_file_size
.
InnoDB日志位于ib_logfile0和ib_logfile1中。这些是innodb_log_file_size大小的文件。
To resize the InnoDB logs, you first need to shut down mysqld cleanly. That will make sure that any changes in the log have already been flushed into your tablespaces. The clean shutdown is important, because if you don't do this step, you have a high chance of losing data.
要调整InnoDB日志的大小,首先需要干净地关闭mysqld。这将确保日志中的任何更改都已刷新到您的表空间中。干净关闭很重要,因为如果不执行此步骤,则很有可能丢失数据。
After you have shut down mysqld cleanly, the ib_logfiles are superfluous. You must rm
them to change their size.
在你干净地关闭mysqld之后,ib_logfiles是多余的。你必须让他们改变他们的大小。
As you restart mysqld, InnoDB notices that the files are missing, and creates new file at the new size according to the innodb_log_file_size
variable in your my.cnf file. So make sure you edit that file before you restart, or else it'll just create new 5MB files.
当您重新启动mysqld时,InnoDB会注意到文件丢失,并根据my.cnf文件中的innodb_log_file_size变量以新大小创建新文件。因此,请确保在重新启动之前编辑该文件,否则它只会创建新的5MB文件。
MySQL 5.6 makes this process a little bit simpler. You don't need to rm
the log files, but you do need to restart mysqld to make a new log file size take effect. The way it works in 5.6 is that if the size of these files is different from the config variable, MySQL automatically does another clean restart (to make sure the files don't contain any changes that are unflushed), and then InnoDB resizes the files upon the final startup.
MySQL 5.6使这个过程更简单一些。您不需要rm日志文件,但您需要重新启动mysqld以使新的日志文件大小生效。它在5.6中的工作方式是,如果这些文件的大小与config变量不同,MySQL会自动执行另一次干净重启(以确保文件不包含任何未刷新的更改),然后InnoDB调整文件大小在最后的启动。
The other files (mysql-bin.000001, etc.) are binary logs. These may grow up to max_binlog_size
(which is 1GB by default), but the binary logs vary in size because new logs are created whenever you restart mysqld or execute FLUSH LOGS
. Anyway, they have nothing to do with the InnoDB logs.
其他文件(mysql-bin.000001等)是二进制日志。这些可能会增长到max_binlog_size(默认为1GB),但二进制日志的大小不同,因为每当您重新启动mysqld或执行FLUSH LOGS时都会创建新日志。无论如何,它们与InnoDB日志无关。
PS: You might like this article: How to calculate a good InnoDB log file size.
PS:你可能会喜欢这篇文章:如何计算一个好的InnoDB日志文件大小。