这些选项指定与备份映像或目录相关的各种参数,或者与备份恢复方式相关的参数。通常,--backup-image和
是您在使用mysqlbackup--backup-dir时需要指定的组中的唯一选项
。
备份存储库选项用于以下操作:
恢复操作:
copy-back,copy-back-and-apply-log.
备份存储库选项分为两组:第一组确定备份的结构,第二组提供有关备份服务器上数据原始结构的信息,以便将来对备份进行操作。
以下选项确定备份的结构:
--backup-image=IMAGE命令行格式 --backup-image=IMAGE类型 文件名 指定用于单文件备份、还原或其他 单文件操作的文件的路径名。
除了使用 流式传输备份图像时
--backup-image=-,如果--backup-image没有给出完整路径名,这就是 mysqlbackup解释选项值的方式:对于
backup-to-image操作,mysqlbackup将值--backup-image作为相对于指定位置的路径--backup-dir。如果--with-timestamp还使用该选项,则备份映像将保存在 备份目录下名称中带有时间戳的子目录中。对于 版本 4.1.5 及更高版本的 AND以外 的
copy-back-and-apply-log其他 单文件操作, mysqlbackup将值 作为相对于运行mysqlbackup命令的当前工作目录的路径。backup-to-image--backup-image笔记对于 4.1.4 及更早版本: 指定的相对路径
--backup-image被视为相对于 上述操作 的备份目录。
By default, the single-file backup is streamed to standard output, so that you can pipe it directly to other commands such as a tape backup or an ssh-related network command.
You can optionally prefix the image name with
file:to signify a file I/O (the default). For tape backups, prefix the image name withsbt:. See Section 4.3.1.2, “Backing Up to Tape” for details about tape backups.
Same as
--backup-dir. The backup directory under which the backup data and metadata are stored, permanently or temporarily. It is a crucial parameter required for most kinds of backup and restore operations.The option is used differently for different operations and under different situations:
For backup to a single file (including incremental, compressed, encrypted, and cloud backups): Use
--backup-dirto supply a temporary folder to save the backup metadata (including the mysqlbackup message log, the start and end LSN, and so on) and some temporary output. The backup data, together with a copy of the metadata, will be stored in a singe file whose name is specified with the--backup-imageoption. Note that, however, if--backup-imagedoes not give a full path name, mysqlbackup will actually take the value of--backup-imageas a path relative to the directory specified by--backup-dir, and thus store the single-file backup under--backup-dir(or, if the--with-timestampoption is used, under a subdirectory created under--backup-dir, which bears the timestamp in its name).For backup to a directory: Use
--backup-dirto specify the directory to store the backup data and metadata (including the mysqlbackup message log, the start and end LSN, and so on). The directory specified by--backup-dircannot be a subdirectory of the directory specified by--datadir.When the
--with-timestampoption is also specified, an additional level of subdirectory, with the timestamp in its name, is created under--backup-dir(see description for the--with-timestampoption for details). Unless the--with-timestampoption is used, the directory specified by--backup-dirmust be empty, or the backup operation will fail with an error.For restoring a single-file backup (including incremental, compressed, encrypted, and cloud backups): When using
copy-back-and-apply-logto restore a single-file backup, use--backup-dirto supply a temporary folder to store the temporary data of the restore operation. The directory specified by--backup-dirshould be empty—if a non-empty directory is used, the restore operation will still be carried out, but the restore data might be corrupted.When restoring a single-file backup created with the option setting
use-tts=with-minimum-locking, the folder specified with--backup-diris also used for extracting temporarily all the tables in the backup and for performing anapply-logoperation to make the data up-to-date before restoring them to the server's data directory.For restoring a backup directory: Use
--backup-dirto specify the location of the backup directory, from which data will be restored to the server.
backup_innodb_data_home_dir=PATHThe directory under which the backup's InnoDB data files are to be stored. Specify the option if you want to put the data files at somewhere other than the default location (which is
). If the value of the parameter is different frombackup-dir/datadir, it is stored into thebackup-dir/datadirbackup-my.cnffile asinnodb_data_home_dirfor information, so that mysqlbackup can understand the structure of the backup when it performs various operations on the backup. Together withbackup_innodb_data_file_pathoption, it determines the actual file paths of the InnoDB data files inside the backup.The value for the parameter is derived as follows:
If
backup_innodb_data_home_diris not specified, its value will be.backup-dir/datadirIf
backup_innodb_data_home_diris an absolute path, its value is used as-is.If
backup_innodb_data_home_diris a relative path, the path is taken to be relative to (that is, underneath)backup-dir.An empty string (“”) for
backup_innodb_data_home_dirmeans the value ofinnodb_data_file_pathis to be taken as an absolute path..
This parameter is applicable only for backup operations; during a restore, the InnoDB data files are restored under the data directory specified by
--datadir, unless another location is specified using the--innodb_data_home_diroption during restore.backup_innodb_data_file_path=VALUEThe InnoDB data file names and sizes. Examples:
ibdata1:32M;ibdata2:32M:autoextend /abs/path/ibdata1:32M:autoextend innodb-dir/ibdata1:32M:autoextendThis parameter, together with
backup_innodb_data_home_dir, determines where the InnoDB data files are stored within the backup repository. Any file path specified with this option is taken to be relative to the value of thebackup_innodb_data_home_diroption (that is true even if the file path is specified in the form of an absolute path, like/abs/path/ibdata1:32M:autoextend). To specify truly absolute paths for InnoDB data files in the backup with this option, you must set thebackup_innodb_data_homeoption to""[empty string], in addition to using an absolute path for this option.When the parameter is not specified, it inherits the value from the value of the
innodb_data_file_pathoption on the backed-up server. If both the source and destination of the backup attempt to use the same absolute paths that resolves to the same files, the backup is cancelled.The value of the parameter is stored into the
backup-my.cnffile asinnodb_data_file_pathfor information, so that mysqlbackup can understand the structure of the backup when it performs various operations on the backup.backup_innodb_log_group_home_dir=PATHThe directory under which the backup's InnoDB logs will be stored. Specify this option only if you want to put the logs at somewhere other than the default location (which is
). If the value of the parameter is different frombackup-dir/datadir, it is stored in thebackup-dir/datadirbackup-my.cnffile asinnodb_log_group_home_dirfor information, so that mysqlbackup can understand the structure of the backup when it performs various operations on the backup. Note that while you can specify a directory for saving the logs, the names of the log files are fixed and not reconfigurable.This parameter is applicable only for backup operations; during a restore, the InnoDB log files are restored under the data directory specified by
--datadir, unless another location is specified using the--innodb_log_group_home_diroption during restore. The value of the parameter is derived as follows:If
backup_innodb_log_group_home_diris not specified, its value will be.backup-dir/datadirIf
backup_innodb_log_group_home_diris an absolute path, its value is used as-is.If
backup_innodb_log_group_home_diris a relative path, the path is taken to be relative to (that is, underneath)backup-dir.An empty string (“”) for the option produces an error.
backup_innodb_undo_directory=PATHThe relative or absolute directory path where separate tablespaces are created for the InnoDB undo logs during the backup. When unspecified, the option takes up the same value as
backup_innodb_log_group_home_dir; specify this option only if you want to put the undo logs at some other location. If the value of the parameter is different from, it is stored in thebackup-dir/datadirbackup-my.cnffile asinnodb_undo_directoryfor information, so that mysqlbackup can understand the structure of the backup when it performs various operations on the backup.This parameter is applicable only for backup operations; during a restore, the InnoDB undo log tablespaces are restored under the data directory specified by
--datadir, unless another location is specified by the--innodb_undo_directoryoption during restore.Creates a subdirectory underneath the backup directory, with a name formed with the timestamp of the backup operation. It is useful for maintaining a single backup directory containing many backup snapshots put under different subdirectories.
Default: no timestamped subdirectory is created. To reuse the same backup directory for a new backup without using this option, either remove the previous backup files manually or, for a single-file backup, specify the
--forceoption to overwrite the old backup file.
The following parameters provide information on the original structure of the data on the backed-up server for future operations on the backup, but do not affect the structure of the backup itself:
backup_innodb_log_files_in_group=NThe number of InnoDB log files in a log group on the restored server. See the description for
innodb_log_files_in_groupin the MySQL server manual. The value for this parameter, saved asin theinnodb_log_files_in_groupbackup-my.cnffile, is derived as follows:Use the
backup_innodb_log_files_in_groupvalue from command line or configuration file, if specified.Else, use the
innodb_log_files_in_groupvalue from the backed-up server, if it is an online backup.Else, use the
innodb_log_files_in_groupvalue from the mysqlbackup command line or configuration file.
backup_innodb_log_file_size=SIZEThe maximum single InnoDB log file size in backup before switching to next log file, on the restored server. See the description for
innodb_log_file_sizein the MySQL server manual. The value for this parameter, saved asin theinnodb_log_file_sizebackup-my.cnffile, is derived as follows:Use the
backup_innodb_log_file_sizevalue from command line or configuration file, if specified.Else, use the
innodb_log_file_sizevalue from the backed-up server, if it is an online backup.Else, use the specified
innodb_log_file_sizevalue from the mysqlbackup command line or configuration file.
Specifies, for an offline backup, the page size for all InnoDB tablespaces on the restored server. This option should be specified carefully, because the page size must be the same as that of the backed up MySQL instance, or the backup could become useless. For an online backup, the value is taken from the value of the
innodb_page_sizeoption on the backed-up server.Value of this option is saved in the
backup-my.cnffile, to be used for restoring the database.backup_innodb_undo_logs=NUMBERSpecifies, for an offline backup, the number of rollback segments in the InnoDB system tablespace on the restored server. This option should be specified carefully, because the value must be the same as that of
innodb_undo_logson the backed-up MySQL instance, or the backup could become useless. For an online backup, the value for the parameter is taken from the value of theinnodb_undo_logsoption on the backed-up server.backup_innodb_undo_tablespaces=NUMBERSpecifies the number of tablespace files that the undo logs are divided between, when you use a non-zero
backup_innodb_undo_logssetting. This option should be specified carefully, because the value must be the same as that ofinnodb_undo_tablespaceson the backed-up MySQL instance, or the backup could become useless. For an online backup, the value for the parameter is taken from the value of theinnodb_undo_tablespacesoption on the backed-up server. By default, all the undo logs are part of the system tablespace, and the system tablespace will always contain one undo tablespace in addition to those configured by innodb_undo_tablespaces.backup_innodb_checksum_algorithm=NAMESpecifies, for an offline backup, the name of the checksum algorithm used for validating the InnoDB tablespaces on the restored server. This option should be specified carefully, because the checksum algorithm must be the same use on the backed-up MySQL instance, or the backup could become useless. For an online backup, the value is taken from the value of the
innodb_checksum_algorithmoption on the backed-up server.Default value of the option is “innodb”.
Value of this option is saved in the
backup-my.cnffile, to be used for restoring the database.