Reputation:
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.
- Setup slave
- Stop replication.
- Make ALTER on slave
- Let slave catch up the master
- swap master and slave, so slave becomes production server with changed structure and minimum downtime
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.
Upvotes: 4
Views: 1182
Reputation: 47321
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.
Upvotes: 1