If you've been reading all the mail I've been generating about
replication recently, you know what this is. If not, read on...
WHAT IS IT?
-----------
myrepl is a Perl script which helps to setup replication for the
first time on a MySQL master server. myrepl will do all of its
work WITHOUT HAVING TO SHUT DOWN YOUR MYSQL SERVER TO COPY
DATA. The only catch is that you must have binary logging enabled
prior to running myrepl. But that requires only 5 seconds of
down-time.
WARNING: This has been tested on several systems I have access to,
but it is rather new. It is certainly not perfect
yet. I'd love for folks to try it out.
WHERE TO GET IT
---------------
Fetch it from this URL:
http://public.yahoo.com/~jzawodn/myrepl/myrepl.gz
or mail me if you can't get that URL for some reason. There's no
README on-line yet. This e-mail is the README. :-)
HOW TO USE IT
-------------
(0) Create a replication user on your master server:
mysql> GRANT FILE ON *.* TO repl@"%" IDENTIFIED BY '<password>';
as explained here: http://www.mysql.com/doc/R/e/Replication_HOWTO.html
(1) Make sure that binary logging is enabled. Simply add two lines
to the [mysqld] section of my.cnf on your master:
[mysqld]
server-id=1
log-bin
and restart your MySQL server. This can be done well in advance
of when you are ready to run myrepl as long as you have enough
disk space to hold the binary log.
(2) As root on your master, run:
./myrepl -u root -p <password> -s /some/directory
and myrepl will produce a single tar file (snapshot.tar) in
/some/directory which contains all the data which you need to
copy to your slave(s). It also resets the binary log so that you
won't run into trouble with the data being older or newer than
the binary log was started.
Make sure you have enough space in /some/directory for the
snapshot file!
(3) Copy snapshot.tar to each slave and untar it in the MySQL data
directory.
cd <data-dir>
tar -xvf /path/to/snapshot.tar
rm /path/to/snapshot.tar
chown -R <mysql-user> <data-dir>
(4) Add the necessary entries in my.cnf on each salve:
[mysqld]
master-host=<hostname of the master>
master-user=repl
master-password=<repl-user-password>
server-id=<some unique number between 2 and 2^32-1>
as explained here: http://www.mysql.com/doc/R/e/Replication_HOWTO.html
(5) Start your slave(s). They should replicate.
NOTES
-----
* It'd be handy to create a compressed tar file (.tar.gz). I'll
probably add that.
* It'd be nice to specify which databases/tables not to snapshot
(or to say "only snapshot these databases/tables"). If folks
need that, it can be added also.
* Running myrepl with no arguments will give you help about the
command-line options.
Comments and feedback welcome. Half the reason I wrote this was to see
if it would work. The other half is that I figured it'd be useful if
it did. :-)
Thanks,
Jeremy
--
Jeremy D. Zawodny, <[EMAIL PROTECTED]>
Technical Yahoo - Yahoo Finance
Desk: (408) 328-7878 Fax: (408) 530-5454
Cell: (408) 439-9951
---------------------------------------------------------------------
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