Jeremy D. Zawodny wrote:

> On Wed, Jan 17, 2001 at 09:46:40PM -0800, Mike Wexler wrote:
> 
> 
> 
> 
>> It appears to be clearer, but its hard to tell unless you are
> 
>> actually trying to set it up. The first time I read it, I was
> 
>> setting up replication and the same time.
> 
> 
> 
> So was I. And I failed the first 2 or 3 times until I made some
> 
> assumptions and guesses.
> 
> 
> 
> 
>> My one concern, is it sounds like in order to set up replication you
> 
>> need to bring down the master for long enough to archive all the
> 
>> databases.
> 
> 
> 
> You do need to bring the server down briefly to at least have it pick
> 
> up the binary log entry in my.cnf. But that's really it.

I understand that, but that is just a matter of a few seconds. According 
to this:

> Shut down MySQL on the master. 
> mysqladmin -u root -p<password> shutdown
> 
> Snapshot all the data on your master server. The easiest way to do this (on Unix) is 
>to simply use tar to produce an archive of your entrie data directory. The exact data 
>directory location depends on your installation. 
> tar -cvf /tmp/mysql-snapshot.tar /path/to/data-dir
> 
> Windows users can use WinZip or similar software to create an archive of the data 
>directory. 
> In my.cnf on the master add log-bin and server-id=<some unique number> to the 
>[mysqld] section. 
> [mysqld]
> log-bin
> server-id=1
> 
> Restart MySQL on the master. 

the archving needs to be done while the server is down. That is 
considerably more than a few seconds for a large set of databases.



> I believe so. What you MUST do is get a consistent snapshot of your 
> data which matches the time at which your enable the binary log on
> your server. I'm working on a section for the manual that describes
> how to do it in a more on-line fashion. Here's the rough untested
> idea...
> 
> 
> 
>   * Enable binary logging in my.cnf. This requires a server
>     stop/start, but that's a few seconds of downtime.
> 
> 
>   * Get a READ lock on ALL your tables for as long as it takes to back
>     them up. That allows other clients to at least run SELECTs while
>     you do it.
> 
>   * The moment you snapshot finishes, run a "RESET MASTER" to reset
>     the binary log.
> 
>   * Release the READ locks and let things run as normal.
> 
>   * Setup your slaves whenever you get around to it...

This is a big improvement. What would be really cool would be to read 
lock a table, copy it to the slave, and then tell the slave to start 
paying attention to the binary log for *that* table. Then it would 
repeat this for all tables. During the process, that slave would have 
inconsistent versions of the database, but at the end the slave would be 
entirely consistent with the master.


> Come to think of it, it wouldn't be that hard to script this process.
> I think I just might try that. :-) It'd sure make a nice addition to
> the MySQL distribution.

This would be very nice. Up their with mysqltop.

 
> Damn. And I was planning on going to bed early...

There is always tomorrow...



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