将MySQL中的二进制日志移动到其他硬盘

时间:2022-09-24 11:13:33

This question is about MySQL binary logs.

这个问题是关于MySQL二进制日志的。

We need to move a binary log to a different hard disk.

我们需要将二进制日志移动到另一个硬盘。

What is the configuration change required in MySQL?

MySQL需要什么配置更改?

Currently binary logs go into the same folder as the ibdata and there is a replication slave running which needs the binary logs.

目前,二进制日志与ibdata位于同一文件夹中,并且运行的复制从站需要二进制日志。

2 个解决方案

#1


7  

Changing the log-bin works. BUT you need to copy the log-bin files first to the new location and modify the index file. If you dont'do this you will break your remote slave with the error:

更改日志箱工作。但是您需要先将log-bin文件复制到新位置并修改索引文件。如果您不这样做,您将使用错误打破远程从站:

Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'

从二进制日志读取数据时,来自master的致命错误1236:'无法在二进制日志索引文件中找到第一个日志文件名'

More info here: http://freebsd.down-to-details.com/sys-admin/relocating-moving-mysql-binlogs/

更多信息:http://freebsd.down-to-details.com/sys-admin/relocating-moving-mysql-binlogs/

#2


2  

From the way I read the doc, you can specify a path on the log-bin config.

从我阅读文档的方式来看,您可以在log-bin配置中指定路径。

To enable the binary log, start the server with the --log-bin[=base_name] option. If no base_name value is given, the default name is the value of the pid-file option (which by default is the name of host machine) followed by -bin. If the basename is given, the server writes the file in the data directory unless the basename is given with a leading absolute path name to specify a different directory. It is recommended that you specify a basename; see Section C.5.8, “Known Issues in MySQL”, for the reason.

要启用二进制日志,请使用--log-bin [= base_name]选项启动服务器。如果没有给出base_name值,则默认名称是pid-file选项的值(默认情况下是主机的名称),后跟-bin。如果给出了基本名称,则服务器将该文件写入数据目录,除非给出带有前导绝对路径名的basename以指定其他目录。建议您指定基名;有关原因,请参见第C.5.8节“MySQL中的已知问题”。

#1


7  

Changing the log-bin works. BUT you need to copy the log-bin files first to the new location and modify the index file. If you dont'do this you will break your remote slave with the error:

更改日志箱工作。但是您需要先将log-bin文件复制到新位置并修改索引文件。如果您不这样做,您将使用错误打破远程从站:

Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'

从二进制日志读取数据时,来自master的致命错误1236:'无法在二进制日志索引文件中找到第一个日志文件名'

More info here: http://freebsd.down-to-details.com/sys-admin/relocating-moving-mysql-binlogs/

更多信息:http://freebsd.down-to-details.com/sys-admin/relocating-moving-mysql-binlogs/

#2


2  

From the way I read the doc, you can specify a path on the log-bin config.

从我阅读文档的方式来看,您可以在log-bin配置中指定路径。

To enable the binary log, start the server with the --log-bin[=base_name] option. If no base_name value is given, the default name is the value of the pid-file option (which by default is the name of host machine) followed by -bin. If the basename is given, the server writes the file in the data directory unless the basename is given with a leading absolute path name to specify a different directory. It is recommended that you specify a basename; see Section C.5.8, “Known Issues in MySQL”, for the reason.

要启用二进制日志,请使用--log-bin [= base_name]选项启动服务器。如果没有给出base_name值,则默认名称是pid-file选项的值(默认情况下是主机的名称),后跟-bin。如果给出了基本名称,则服务器将该文件写入数据目录,除非给出带有前导绝对路径名的basename以指定其他目录。建议您指定基名;有关原因,请参见第C.5.8节“MySQL中的已知问题”。