If you use MySQL replication, MySQL Enterprise Backup allows you to set up a slave database without stopping the master, by backing up the master and restoring that backup on a new slave server.
Take the backup, transfer it to the slave server, use mysqlbackup with the
apply-logoption to prepare it, and put the restored backup and the log files in the right directories for the new slave.
my.cnffile of the new slave and put
Start the new slave mysqld (version >= 5.1). It prints the latest MySQL binary log position the backup knows of.
… InnoDB: Last MySQL binlog file position 0 128760128, file name ./hundin-bin.006 …
Note that InnoDB only stores the binary log position information to its tablespace at a transaction commit. To make InnoDB aware of the current binary log position, you must run at least one transaction while binary logging is enabled.
CHANGE MASTERSQL command on the slave to initialize it properly. For example:
CHANGE MASTER TO MASTER_LOG_FILE='hundin-bin.006', MASTER_LOG_POS=128760128;
Set the statuses of any events that were copied from the master to
SLAVESIDE_DISABLED. For example:
mysql> UPDATE TABLE mysql.event SET status = 'SLAVESIDE_DISABLED';
Start replication in the new slave with the
SLAVE STARTSQL command.
Remove the line
my.cnffile of the slave.