Sasha, thanks for your help!
But I'm not sure we're in agreement about what is happening yet: Sasha Pachev wrote: > On Wednesday 26 December 2001 01:24 pm, Venu wrote: > >>Since replication is only one-way, there really shouldn't be any updates >>happening on the slave, but in the failover case, I've got no choice. NOTE the failover happens automatically when the master fails for some reason. >> >>So how do I isolate those updates and reapply them to the master, >>and switch back? >> > > Steve: > > Here is how you can do the above: > > * make sure slave runs with log-bin. > > * before you direct updates to the slave, record the binlog offset and > position on the slave by running SHOW MASTER STATUS ( on the slave not on the > master!) Whoops! When the failover occurs, there is nobody at the console to record the offset! It's an automatic failover when the master fails! It might have happened at 4 in the morning yesterday. How do we automatically know the master has failed and record that offset? > > * when you bring back the master, do CHANGE MASTER TO > MASTER_HOST='slave.mycompany.com', MASTER_USER='rpluser_on_slave', > MASTER_PASSWORD='rpl_pass_on_slave', MASTER_LOG_FILE='recorded_log_name', > MASTER_LOG_POS=recorded_log_pos; SLAVE START > > * on slave, FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS; > > * record log_name and log_pos > > * on master SELECT MASTER_POS_WAIT('log_name',log_pos) > > * redirect updates to the old master when the above returns ( this will > happen when master fully synced up with the slave > > * on slave UNLOCK TABLES > > Depending on the nature of your queries you may have some conflicts. most > likely, queries that cause the conflict in this case can be skipped, so if > you can just add --slave-skip-errors=1062 ( to skip duplicate key errors) in > the master my.cnf > > I will put the above in the manual... > > -- Steve Rapaport World Citizen --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php