Think of the binary log as just a long binary data stream, which simply
happens to be in a series of files.  Each slave has a position in that
binary stream, which is expressed as a filename and file position.
Each slave has (potentially) a different position in the stream, and
therefore a different file and different position in that file.

The "current" log is only relevant to the master, as in which log file
its writing to.  Each slave will have its own idea of what the "current"
log file is, based on where it is in the stream.

The CHANGE MASTER TO command simply instructs the slave to start at
position X in the binary stream, which has to correspond to the point
that the snapshot was made for that particular slave.  Each slave can
have a different snapshot, and a different starting point in the stream.
You can take a new snapshot at any time and simply start a slave at the
"current" point in the stream (show master status displays this), which
makes it relatively easy to add a new slave to a set.  The best way to
do this is:

master_mysql> flush tables with read lock;
master_mysql> show master status;
copy files to slave
slave_mysql> change master to <values from show master status>
master_mysql> unlock tables;

This is also a good way to re-sync a slave if it crashes and corrupts
its tables.

james montebello

On Thu, 7 Feb 2002, Mark M. Ito wrote:

> MySQL folks,
> 
> I am planning on using MySQL replication to mirror a database at
> various far-flung locations. I'm anticipating that there might be a
> handful of slaves, but they will only come on every few months. In
> that scenario, the last slave will have a lot of catching up to do if
> all slaves are started from the same snapshot. It's conceivable that
> this process extends over years. In planning this, the following
> related questions occur to me while reading the manual:
> 
> Can slave start from a binary log that is not the current log?
> 
> Does a slave always start from the beginning of the current binary log?
> 
> In the CHANGE MASTER TO command, what is the interpretation of the
> value of MASTER_LOG_POS? I. e., how does one know what number to
> provide here?
> 
> Any help would be appreciated.
> 
>   -- Mark
> 
> --
> Mark M. Ito, Thomas Jefferson National Accelerator Facility
> 12000 Jefferson Ave., Mail Stop 12H, Newport News, VA 23606
> Email: [EMAIL PROTECTED], Phone: (757)269-5295
> WWW: http://claspc2.jlab.org
> 
> 
> ---------------------------------------------------------------------
> 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
> 


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