I answered a question on how to use rsync to copy a live DB to another location.
You would repeat rsync process multiple times until two rsync's run in the same time.
Then, you would shutdown mysql on the master, perform a final rsync to the new server, and start mysql on the master.
You then properly prep the new server, make sure /var/lib/mysql has everything, make sure you erase all binary logs on the new server, and make sure you have the same my.cnf on both machines (you may want to change the server_id)
Here is an excerpt from that link:
Step 01) install the same version of mysql on ServerB that ServerA has
Step 02) On ServerA, run SET GLOBAL innodb_max_dirty_pages_pct = 0;
from mysql and about 10 minutes (This purges dirty pages from the InnoDB Buffer Pool. It also helps perform a mysql shutdown faster) If your database is all MyISAM, you can skip this step.
Step 03) rsync /var/lib/mysql of ServerA to /var/lib/mysql on ServerB
Step 04) Repeat Step 03 until an rsync takes less than 1 minute
Step 05) service mysql stop
on ServerA
Step 06) Perform one more rsync
Step 07) scp ServerA:/etc/my.cnf to ServerB:/etc/.
Step 08) service mysql start
on ServerB
Step 09) service mysql start
on ServerA (optional)
Give it a Try !!!
you run this in slave host (pdb-0001 is remote Master DB)
mysqldump --add-drop-database -umiadmin -pXXX -h qdb-0001 -P3306 --single-transaction \
--apply-slave-statements=true --include-master-host-port --master-data=1 \
--databases c0006 | mysql -u miadmin -pXXXX -h 127.0.0.1
Best Answer
On your Slave issue the
STOP SLAVE
,START SLAVE
commands to stop / start replication on Demand. If you want to run it to a schedule write a batch file / cron toSTOP SLAVE
andSTART SLAVE
at the required times. I'm assuming you have a good reason for doing this?