Hi!

I'm using mysql version 3.23.29a under a heavy loaded production
environment. Now I've set up our mysql server as replication master and
installed second mysql machine to be the slave.

Replications as itself works, but how do I get the slave server in sync with
the master without shutting down the master, which I can only do at 04:00am
or so.

The may not be a problem, if I have to do this only once, but if I recognize
that the slave is out of sync, I'd like to switch the load from the slave
back to the master and stop the slave. Then I need some way to bring the
slave in sync again.

Did I mention that I use the master for read/write and the slave for read
access only?

My solution I worked out, is the following:

* slave with empty DB is assumed
* master clears all binlogs, and gets restarted

1. create for each table on the master an empty one on the slave
2. start slave
-> new entries on the master are done on the slave too

now do this loop for each data_table:

3. 'LOCK TABLE data_table READ' on master
4. 'LOAD TABLE data_table FROM MASTER' on slave
-> master and slave are in sync for table 'data_table'
-> running replication thread does't change slave, because binlog contains
no entries for 'data_table' on master
5. 'UNLOCK TABLES' on master
-> since the replication is running, changes to 'data_table' on master are
passed to teh slave

If I do steps 3. to 5. for each table, every table which has been already
processed, should keep in sync with the master and I finally have a running
slave. Its okay for me to lock each tables separately and not the whole DB.


Does anyone agree with this solution?
Any help would be appreciated.

-- 
Martin


---------------------------------------------------------------------
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

Reply via email to