当您确定不存在用户错误,并且复制仍然完全不工作或不稳定时,就该向我们发送错误报告了。我们需要从您那里获取尽可能多的信息,以便追踪错误。请花一些时间和精力准备一个好的错误报告。When you have determined that there is no user error involved, and replication still either does not work at all or is unstable, it is time to send us a bug report. We need to obtain as much information as possible from you to be able to track down the bug. Please spend some time and effort in preparing a good bug report.
如果您有一个可以重复的测试用例来演示该错误,请按照 第 1.6 节,“如何报告错误或问题” 中给出的说明将其输入我们的错误数据库。如果您遇到的是 “幻影” 问题(无法随意重复出现的问题),请使用以下程序:If you have a repeatable test case that demonstrates the bug, please enter it into our bugs database using the instructions given in Section 1.6, “How to Report Bugs or Problems”. If you have a “phantom” problem (one that you cannot duplicate at will), use the following procedure:
确认没有用户错误。例如,如果您在复制线程之外更新副本,数据会失去同步,并且在更新时可能出现唯一键冲突。在这种情况下,复制线程会停止并等待您手动清理表以使其同步。这不是复制问题。这是外部干扰导致复制失败的问题。Verify that no user error is involved. For example, if you update the replica outside of the replication threads, the data goes out of synchrony, and you can have unique key violations on updates. In this case, the replication thread stops and waits for you to clean up the tables manually to bring them into synchrony. This is not a replication problem. It is a problem of outside interference causing replication to fail.
确保副本在启用二进制日志记录的情况下运行(
log_bin系统变量),并启用--log-replica-updates选项,这会导致副本将从源接收到的更新记录到自己的二进制日志中。这些设置是默认设置。Ensure that the replica is running with binary logging enabled (thelog_binsystem variable), and with the--log-replica-updatesoption enabled, which causes the replica to log the updates that it receives from the source into its own binary logs. These settings are the defaults.在重置复制状态之前保存所有证据。如果我们没有信息或只有零散信息,我们就很难甚至无法追踪问题。你应该收集的证据是:Save all evidence before resetting the replication state. If we have no information or only sketchy information, it becomes difficult or impossible for us to track down the problem. The evidence you should collect is:
来自源的所有二进制日志文件All binary log files from the source
来自副本的所有二进制日志文件All binary log files from the replica
在您发现问题时,来自源的
SHOW BINARY LOG STATUS输出The output ofSHOW BINARY LOG STATUSfrom the source at the time you discovered the problem在您发现问题时,来自副本的
SHOW REPLICA STATUS输出The output ofSHOW REPLICA STATUSfrom the replica at the time you discovered the problem来自源和副本的错误日志Error logs from the source and the replica
使用 mysqlbinlog 来检查二进制日志。以下内容应有助于找到问题语句。
log_file和log_pos是来自SHOW REPLICA STATUS的Master_Log_File和Read_Master_Log_Pos值。Use mysqlbinlog to examine the binary logs. The following should be helpful to find the problem statement.log_fileandlog_posare theMaster_Log_FileandRead_Master_Log_Posvalues fromSHOW REPLICA STATUS.$>
mysqlbinlog --start-position=log_poslog_file| head
在收集了问题的证据之后,先尝试将其作为一个独立的测试用例隔离出来。然后按照第 1.6 节,“如何报告错误或问题”中的说明,将问题以及尽可能多的信息输入我们的错误数据库。After you have collected the evidence for the problem, try to isolate it as a separate test case first. Then enter the problem with as much information as possible into our bugs database using the instructions at Section 1.6, “How to Report Bugs or Problems”.