The warning about --log-slave-updates
will only apply if you had multiple intermediary 'Master/Slave' servers.
The warning is this (my emphasis):
Then it will write updates that it receives from Master to its own binary log. When Slave 2 changes from Master to Slave 1 as its master, it may receive updates from Slave 1 that it has already received from Master
But in your scenario, Slave 2
is not changing masters, it will still point to the same Master 2
server it always was at.
So now, in case of Master 1
failing, you will need to do two things:
- Make sure your applications point to
Master 2
- Follow the instructions on promoting one of the three slaves to be new
Master 2
- make sure to enable
--log-slave-updates
on the new Master 2
Something is not right about your process.
Usually, when I see error 1236, such the following I used in my old post How can you monitor if MySQL binlog files get corrupted?
[ERROR] Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236).
[ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position', Error_code: 1236
111014 20:25:48 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.001067', position 183468345.
here was the situation: When doing MySQL Replication without GTID, the IO Thread examines the position from the latest Master binlog. If Read_Master_Log_Pos
is bigger than the actual filesize of the binlog, you get error 1236.
When doing MySQL Replication with GTID, the situation is somewhat similar. The IO Thread is looking for some kind of closure with regard to the GTID it was last using. When you restarted MySQL on the Master, you closed the last binlog on the Master and opened a new binlog upon startup. The IO Thread on the Slave was still active. Thus, the same error number is coming up.
The next time you restart a Master, remember the Slaves are active.
The slave should have reconnected after a minute, but that is not happening for you.
To play it safe, you should do the following
- On the Slave,
STOP SLAVE;
- On the Master,
service mysql restart
- On the Slave,
START SLAVE;
You should not have to do this. As an alternative, try setting up replication with heartbeat set at one tenth of a second:
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD = 100;
This should make the IO Thread on the Slave a little more sensitive
Best Answer
First, you might want to explicitly set those options to on and restart the instance (enabling binary logging requires restart) log_slave_updates=ON log_bin=mysql-binlog
Second, you are not supposed to replicate from a master which is at a higher version to a slave at a lower version because of incompatible changes in binary log formats across versions: https://dev.mysql.com/doc/refman/5.7/en/replication-compatibility.html