| 1 |
# |
| 2 |
# now setup replication to continue from last epoch |
| 3 |
# 1. get ndb_apply_status epoch from slave |
| 4 |
# 2. get corresponding _next_ binlog postition from master |
| 5 |
# 3. change master on slave |
| 6 |
|
| 7 |
# 1. |
| 8 |
|
| 9 |
--connection slave |
| 10 |
SELECT MAX(epoch) FROM mysql.ndb_apply_status into @the_epoch; |
| 11 |
--replace_column 1 <the_epoch> |
| 12 |
SELECT @the_epoch; |
| 13 |
--let $the_epoch= `select @the_epoch` |
| 14 |
|
| 15 |
# 2. |
| 16 |
--connection master |
| 17 |
--disable_query_log |
| 18 |
eval SELECT Position, SUBSTRING_INDEX(REPLACE(FILE,'\\\\','/'), '/', -1) |
| 19 |
FROM mysql.ndb_binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1 into @the_pos, @the_file; |
| 20 |
--replace_result $the_epoch <the_epoch> |
| 21 |
--replace_column 1 <the_pos> |
| 22 |
eval SELECT @the_pos, @the_file; |
| 23 |
--enable_query_log |
| 24 |
--let $the_pos= `SELECT @the_pos` |
| 25 |
--let $the_file= `SELECT @the_file` |
| 26 |
|
| 27 |
# 3. |
| 28 |
--connection slave |
| 29 |
--replace_result $the_pos <the_pos> |
| 30 |
eval CHANGE REPLICATION SOURCE TO |
| 31 |
SOURCE_LOG_FILE = '$the_file', |
| 32 |
SOURCE_LOG_POS = $the_pos ; |