简体   繁体   English

MySQL恢复,包括binlog位置MASTER_LOG_POS

[英]MySQL recovery, include binlog position MASTER_LOG_POS

I run a MySQL DB dump like this: 我这样运行MySQL数据库转储:

mysqldump mydatabase -u root -p --single-transaction --events --routines --quick --master-data=2 --flush-logs --flush-privileges > mydump.sql

This creates a dump file, which contains the following line: 这将创建一个转储文件,其中包含以下行:

CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000008', MASTER_LOG_POS=120;

This tells me that any new changes are recorded starting in mysql-bin.000008 这告诉我,任何新更改都从mysql-bin.000008开始记录

I can then, after loading my dump file, load the incremental files like this (assuming mysql-bin.000009 was also created at some point): 然后,在加载转储文件之后,我可以这样加载增量文件(假设在某个时候还创建了mysql-bin.000009):

mysqlbinlog mysql-bin.000008 mysql-bin.000009 | mysql -u root -p mydatabase

But what about MASTER_LOG_POS = 120? 但是MASTER_LOG_POS = 120呢? Do I need to include that and, if so, how? 我需要包括在内吗? My dump command included --flush-logs so it should have started a brand new file. 我的转储命令包括--flush-logs,因此它应该已经启动了一个全新的文件。

I'm reading the here https://dev.mysql.com/doc/refman/5.7/en/backup-policy.html and here https://dev.mysql.com/doc/refman/5.7/en/recovery-from-backups.html 我正在阅读这里https://dev.mysql.com/doc/refman/5.7/en/backup-policy.html和这里https://dev.mysql.com/doc/refman/5.7/en/recovery -从-backups.html

https://dev.mysql.com/doc/refman/5.6/en/mysqlbinlog.html#option_mysqlbinlog_start-position says: https://dev.mysql.com/doc/refman/5.6/en/mysqlbinlog.html#option_mysqlbinlog_start-position说:

--start-position=N, -j N --start-position = N,-j N

Start reading the binary log at the first event having a position equal to or greater than N. This option applies to the first log file named on the command line. 在位置等于或大于N的第一个事件处开始读取二进制日志。此选项适用于在命令行上命名的第一个日志文件。

This option is useful for point-in-time recovery. 此选项对于时间点恢复很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM