Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Problem with MySQL Delayed Replication

$
0
0

I am testing out MySQL Delayed Replication. But it's not working.

I have a Master DB (5.5) and a Slave DB (5.6) both set up as a normal master/slave setup with statement based replication.

On the Slave I then do:

STOP SLAVE; 

CHANGE MASTER TO MASTER_DELAY = 60;

START SLAVE;

In SHOW SLAVE STATUS I can now see it is running 60 seconds behind.

On the Master I do:

DROP TABLE db1.test1;

On the Slave I then do:

STOP SLAVE;
#Confirm the table is still there#
SHOW SLAVE STATUS; (to get the relay_log_file and pos)
SHOW relaylog EVENTS IN 'relay_log_file_name' FROM relay_log_pos;

I then find the entry where the table was dropped:

Log_name           | Pos  | Event_type | Server_id | End_Log_pos | Info       
slave_relay.000005 | 1470 | Query      | 5         | 104469      | BEGIN
slave_relay.000005 | 1551 | Query      | 5         | 104601      | use `db1`; UPDATE . . . 
slave_relay.000005 | 1683 | xid        | 5         | 104628      | COMMIT /* xid=746 */
slave_relay.000005 | 1710 | Query      | 5         | 104741      | use `db1`; DROP TABLE `test1` /* generated by server */
slave_relay.000005 | 1823 | Rotate     | 7         | 1877        | slave_relay.000006;pos=4

In this case, it was the row with End_log_pos = 104741.

I assume I need to stop ahead of this position, so I do:

START SLAVE UNTIL relay_log_file='slave_relay.000005', relay_log_pos=104740;

I have also tried stopping at (the equivalent of) pos 104627, 104628, 104629 (e.g around the previous COMMIT).

But each time, replication continues until the start of the next relay_log, when it stops.

Am I missing something?


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>