Hi
On 15/12/2009, at 7:10 AM, osolo wrote:
> I'd like your help opinion about the sequence I user (or rather, would
> like to use) to perform schema changes. Logically, it seems that it
> should work, but mmm will fail mid-way.
>
> 1. mmm_control set_offline db2
> 2. (on db1) stop slave
> 3. <perform changes on db2>
> 4. wait for db2 to catch up with db1
> 5. mmm_control set_online db2
> 6. mmm_control move_role writer db2
> 7. (on db1) start slave
> 8. wait for db1 to catch up
> 9. mmm_control move_role writer db1
>
> Like I said, this feels like it should work, but in reality at step 5
> I get this error:
> ERROR: Some replication checks failed on peer 'db1'. We can't set
> 'db2' online now. Please, wait some time.
Perhaps your schema change makes subsequent events fail? Check with
SHOW SLAVE STATUS \G
But, stopping the slave thread does not help at all.
What you *want* is prevent your schema change from being replicated,
because otherwise it'll execute on the active master as well as all
slaves too.
So instead you do this on the non-active master:
SET SESSION SQL_LOG_BIN=0;
ALTER TABLE ...
SET SESSION SQL_LOG_BIN=1; -- or just disconnect
Then you move the active master so you can do the same alter table on
the now passive one.
And then same on each of the slaves in turn (if you have decent
loadbalancing in place)
That way you can do a schema change without affecting the system as a
whole being online and responsive.
Cheers,
Arjen.
--
Arjen Lentz, Exec.Director @ Open Query (
http://openquery.com)
Exceptional Services for MySQL at a fixed budget.
Follow our blog at
http://openquery.com/blog/
OurDelta: packages for MySQL and MariaDB @
http://ourdelta.org