Today, I received a requirement to establish a replication mechanism for MySQL internationally. This is actually nothing, and the network environment is worse, MySQL can also cope with it. However, a time zone error occurs!
The error is as follows:
[Warning] Slave I/O: Get master clock failed with error: Lost connection to MySQL server during query, Error_code: 2
[Warning] Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again, log '1. 100' at position 000001, Error_code: 48920
Slave cannot obtain the clock of the master. The MySQL time_zone variable defaults to = SYSTEM, that is, the SYSTEM time zone is used. Modify the time zone: set global time_zone = '+' or set global time_zone = '-'. Simply modifying the time zone of the database can cause local program confusion, finally, we decided to modify the system time zone. This problem is handed over to our O & M (the time zone of crontab should also be handled), and then we can restart the database.
Here is a brief summary of the precautions for establishing replication:
1. server_id must be unique.
2. binlog and relay_log names must be customized. The hostname. log cannot be used. (when the system hostname is modified, the database may fail to be started)
3. Database time zones must be consistent
4. For dedicated replication users, they must create accounts on the master and slave at the same time (to facilitate failover and prepare for future automation)
5. We recommend that you use replicate _ wild_do_table when filtering the database on the slave side. (In this way, you do not need to consider whether to use the use statement for statement mode replication. Refer: