Steve,

    There isn't an automated way, but you can at least semi-script this.  To
switch the slave to the master after the old master has failed and then
brought back up do this:

Shut down MySQL on the NEW master
mysqladmin -u root -p<password> shutdown

Snapshot all the data on your NEW master server. The easiest way to do this
(on Unix) is to simply use tar to produce an archive of your entire data
directory. The exact data directory location depends on your installation.
tar -cvf /tmp/mysql-snapshot.tar /path/to/data-dir

(Delete all of the bin files in the /usr/local/mysql/data directory on the
old master AND delete the master.info file as well)

Add the following to my.cnf on the NEW Master
[mysqld]
log-bin
server-id=1
(Make sure these are different on each box, this should already be done)

Restart MySQL on the NEW master.

Add the following to my.cnf on the NEW slave(s):
master-host=<hostname of the master>
master-user=<replication user name>
master-password=<replication user password>
master-port=<TCP/IP port for master>
server-id=<some unique number between 2 and 2^32-1>
***Remove these lines from the NEW master system***

replacing the values in <> with what is relevant to your system. server-id
must be different for each server participating in replication. If you don't
specify a server-id, it will be set to 1 if you have not defined
master-host, else it will be set to 2. Note that in the case of server-id
omission the master will refuse connections from all slaves, and the slave
will refuse to connect to a master. Thus, omitting server-id is only good
for backup with a binary log.
Copy the snapshot data into your data directory on your slave(s). Make sure
that the privileges on the files and directories are correct. The user which
MySQL runs as needs to be able to read and write to them, just as on the
master.
Restart the slave(s).



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