开发者

Using MYSQL replication to speed up Schema changes and table optermise

I hear that many people use master - slave arrangements help to improve time taken when changing schemas by using replication to setup a new temporary master, then stopping relocation and then swapping roles before starting again. I have found an example (below) found on stack overflow.

  1. Setup slave
  2. Stop replication.
  3. Make ALTER on slave
  4. Let slave catch up the master
  5. swap master and slave, so slave becomes production server with changed structure and minimum d开发者_运维百科owntime

This is all very well, however, i dont understand step 4 it isn't clear to me.

I wonder if anyone could please explain the procedure clearer.


Let slave catch up the master

Let slave catch up with the master meaning slave is 0 seconds behind master.

This mean if the replication stopped at some point (for you to alter table),
it will register a last replication time.

When the replication resume,
it will compare the current write on master with the last replication time on slave.

However, the procedures seems to be a flaw.
You cannot alter slave and
expecting schema in the updated slave is same as master.

In the events column type changed, column dropped,
potentially lead to replication failure.


seconds_behind_master should be 0.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜