These options are for backing up database servers that play specific roles in replication, or contain certain kinds of data that require special care in backing up.
--slave-info
When backing up a replication slave server, this option captures information needed to set up an identical slave server. It creates a file
meta/ibbackup_slave_info
inside the backup directory, containing aCHANGE MASTER
statement with the binary log position and name of the binary log file of the master server. This information is also printed in the mysqlbackup output. To set up a new slave for this master, restore the backup data on another server, start a slave server on the backup data, and issue aCHANGE MASTER
command with the binary log position saved in theibbackup_slave_info
file. See Section 6.1, “Setting Up a New Replication Slave” for instructions.NoteOnly use this option when backing up a slave server. Its behavior is undefined when used on a master or non-replication server.
This option is not compatible with the
--no-locking
option; using both options together will make mysqlbackup throw an error.This option is not compatible with the
--only-innodb
or--only-innodb-with-frm
options.
--suspend-at-end
This option pauses the mysqlbackup command when the backup procedure is close to ending. It creates a file called
ibbackup_suspended
in the backup log group home directory and waits until you delete that file before proceeding. This option is useful to customize locking behavior and backup of non-InnoDB files through custom scripting.All tables are locked before suspending, putting the database into a read-only state, unless you turn off locking with the
--no-locking
or--no-connection
option. The--only-innodb
and--only-innodb-with-frm
options also prevent the locking step. Because locking all tables could be problematic on a busy server, you might use a combination of--only-innodb
and--suspend-at-end
to back up only certain InnoDB tables.
--exec-when-locked
="utility
arg1
arg2
..."Command-Line Format --exec-when-locked="utility arg1 arg2 ..."
Type String You can use this option to run a script that backs up any information that is not included as part of the usual backup. For example, with
--exec-when-locked
, you can use mysqldump to back up tables from the MEMORY storage engine, which are not on disk.Set any variable you want to use within your script before you run mysqlbackup. In the following example, the
BACKUP_DIR
environment variable is set to point to the current backup directory (quotes are used for the argument of--exec-when-locked
, to prevent premature expansion of the variableBACKUP_DIR
):On Unix or Linux systems:
export BACKUP_DIR=path_to_backupdir mysqlbackup --exec-when-locked='mysqldump mydb t1 > $BACKUP_DIR/t1.sql' other_options mysqlbackup_command
Or on Windows systems:
set BACKUP_DIR=path_to_backupdir mysqlbackup --exec-when-locked="mysqldump mydb t1 > %BACKUP_DIR%/t1.sql" other_options mysqlbackup_command
If the utility cannot be executed or returns a non-zero exit status, the whole backup process is cancelled. If you also use the
--suspend-at-end
option, the utility specified by--exec-when-locked
is executed after the suspension is lifted.