On 01/13/2011 06:34 PM, Larry H. wrote:
> 
> So just to clarify I would be rsyncing the contents of the dbmail database
> folder (/var/lib/mysql/dbmail) to the slave. Then stopping the master and
> rsyncing the innodb log files in (/var/lib/mysql) to the slave. Also, won't
> rsync miss some of the new data coming in on the master as it completes
> certain tables in the data directory during the rsync or is that what the
> second pass is for?


Sucks! Don't do that!

/var/lib/mysql/dbmail will not contain anything!

If you need to resync your slave - assuming you need to do that - you
don't need any downtime.

On the slave:

mysql> slave stop;
# create a consistent snapshot of the master
mysqldump -h $_host -u $_user -p$_pass --quick --single-transaction \
      --flush-logs --master-data=2 --all-databases > $_file
# extract the MASTER log filename and file position from the dumpfile:
sql=`head -n30 /var/tmp/slave.sql|grep 'CHANGE MASTER'|cut -b3-|sed
's/;$//'`
# the sql variable will now look like:
# "CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000005',
#    MASTER_LOG_POS=98,"
# create a valid 'change master' query
sql="$sql,master_host='$MASTERIP',master_user='replication',master_password='${REPLI_PW}';"
# load the dump
cat /var/tmp/slave.sql | mysql
rm -f /var/tmp/slave.sql
# make the slave catch-up from the logfile position
echo $sql|mysql
echo "slave start;" | mysql


This is also one of the procedures mentioned in the mysql docs:

http://dev.mysql.com/doc/refman/5.5/en/replication-howto-mysqldump.html

except that using single-transaction means you don't need to lock the
master.





-- 
  ________________________________________________________________
  Paul Stevens                                      paul at nfg.nl
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands________________________________http://www.nfg.nl
_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to