To backup a replica database, add the
--slave-info option to your backup
To restore the backup on a replica server, follow the same steps outlined in Section 7.1, “Setting Up a New Replica”.
Temporary tables on statement-based replication (SBR) replica. MySQL Enterprise Backup does not include temporary tables inside a backup. As a result, for a replica server in a statement-based replication (SBR) or a mixed-based replication setup (see Replication Formats for details), any temporary tables still open at the end of the backup process will be missing in the restored replica server, making the replication state of the replica inconsistent, and any subsequent replicated statements that refer to the temporary tables will fail. To avoid the issue, after the hot backup phase in which mysqlbackup copies all the InnoDB tables, it enters into a loop, in which the following happens:
mysqlbackup waits until all temporary tables have been closed by the replication SQL thread. mysqlbackup tells if that is the case by checking if the variable
Slave_open_temp_tableshas a zero value.
Slave_open_temp_tables=0is detected, mysqlbackup stops the replication SQL thread to prevent more changes to the tables on the replica.
To avoid the unexpected consequence by a race condition, after the replication SQL thread has been stopped, mysqlbackup checks once more if
Slave_open_temp_tables=0is still true:
If it is true, mysqlbackup exits the loop and finishes the backup by asserting a global read lock and copies all the non-InnoDB tables.
If it is not true, new temporary tables have just been created and opened on the replica. mysqlbackup then restarts the replication SQL thread, so more updates can be made on the replica servers. mysqlbackup then goes back to step 1 of this loop
Besides the exit condition described in step (3) above (which
is, there really are no more open temporary tables and
mysqlbackup is ready to complete the backup),
mysqlbackup will time out after staying in
the above loop for too long to wait for all temporary tables to
be closed. The duration mysqlbackup waits
until it times out is specified by the
In addition, mysqlbackup also runs an initial
check at the beginning of a replica backup to see if
becomes true within the duration set by
--safe-slave-backup-timeout on details
about the check.
Notice that the above-described issue with temporary tables does
not exist for a row-based replication (RBR) setup, for which
temporary tables are not replicated onto the replica. User who are
certain that SBR is not occurring for the replica can set
which will prevent mysqlbackup from entering
the above-mentioned loop.
See the limitation that applies when backing up a replica in Appendix B, Limitations of MySQL Enterprise Backup.