导读
译者:张艺龄
知数堂MySQL DBA班第11期学员
微信号:Randolph_ZYL,欢迎交流、拍转
原文出处:
https://www.percona.com/doc/percona-xtrabackup/LATEST/innobackupex/streaming_backups_innobackupex.html
Create hot InnoDB backups without pausing your database
Make incremental backups of MySQL
Stream compressed MySQL backups to another server
Move tables between MySQL servers on-line
Create new MySQL replication slaves easily
Backup MySQL without adding load to the serve
Percona XtraBackup支持流式备份,将备份以指定的tar或xbstream格式发送到STDOUT,而不是直接将文件复制到备份目录。
This allows you to use other programs to filter the output of the backup, providing greater flexibility for storage of the backup. For example, compression is achieved by piping the output to a compression utility. One of the benefits of streaming backups and using Unix pipes is that the backups can be automatically encrypted.
这允许您使用其他程序来过滤备份的输出,为备份的存储提供更大的灵活性。例如,压缩是通过将输出管道输送到压缩实用程序来实现的。流式备份和使用Unix管道的优点之一:备份可以被自动加密。
To use the streaming feature, you must use the --stream
, providing the format of the stream (tar
or xbstream
) and where to store the temporary files:
使用流式备份,您需要使用--stream参数,指定流式备份格式(tar或xbstream)以及存储临时文件的绝对路径:
innobackupex starts xtrabackup in --log-stream mode in a child process, and redirects its log to a temporary file. It then uses xbstream to stream all of the data files to STDOUT, in a special xbstream format. See The xbstream binary for details. After it finishes streaming all of the data files to STDOUT, it stops xtrabackup and streams the saved log file too.
innobackupex在子进程中启动xtrabackup --log-stream模式,并将其日志重定向到临时文件。然后,使用xbstream将所有数据文件以xbstream格式传输到STDOUT。有关详细信息,请参阅xbstream二进制文件(详见:
https://www.percona.com/doc/percona-xtrabackup/LATEST/xbstream/xbstream.html)。在将所有的数据文件流到STDOUT之后,停止xtrabackup,并将保存的日志文件进行备份。
When compression is enabled, xtrabackup compresses all output data, except the meta and non-InnoDB files which are not compressed, using the specified compression algorithm. The only currently supported algorithm is quicklz. The resulting files have the qpress archive format, i.e. every *.qp file produced by xtrabackup is essentially a one-file qpress archive and can be extracted and uncompressed by the qpress file archiver which is available from Percona Software repositories.
xtrabackup在压缩过程中,将使用指定的压缩算法,压缩所有输出数据,除了元数据和非innodb文件。目前仅仅支持quicklz算法。结果文件是qpress压缩格式,即每个*.qp,xtrabackup生成的qp文件本质上是一个单文件的qpress压缩文件,可以从Percona软件存储库中获得qpress压缩文件的提取和解压方式。
Using xbstream as a stream option, backups can be copied and compressed in parallel which can significantly speed up the backup process. In case backups were both compressed and encrypted, they’ll need to decrypted first in order to be uncompressed.
使用xbstream作流式备份选项,可以并行复制和压缩备份,从而大大加快备份过程。如果备份是压缩和加密,首先需要解密,以便不被压缩。
Store the complete backup directly to a single file:
将完整备份直接存储到单个文件:
To stream and compress the backup:
进行流式和压缩备份:
To unpack the backup to the /root/backup/ directory:
将备份解压到/root/backup/目录:
To send the compressed backup to another host and unpack it:
将压缩后的备份发送到另一个主机并解压:
Store the complete backup directly to a tar archive:
将完整备份直接存储到tar存档文件:
To send the tar archive to another host:
将tar存档文件发送到另一个主机:
Warning:
To extract Percona XtraBackup's archive you must use tar with -i option:
用tar压缩备份,在解压时必须使用 -i 参数:
Compress with your preferred compression tool:
可以选择的压缩方式:
注意:
Note that the streamed backup will need to be prepared before restoration. Streaming mode does not prepare the backup.在恢复之前需要prepared该备份,因为流式备份不会做prepare。
5、总结
1. XtraBackup备份可以做到事务处理不间断,恢复速度快而高效;
2. 使用流式备份可以节省磁盘空间和网络带宽,快速搭建主从。
扫码加入知数堂技术交流QQ群
(群号:579036588)
群内可@各位助教了解更多课程信息
知数堂
叶金荣与吴炳锡联合打造
领跑IT精英培训
行业资深专家强强联合,倾心定制
MySQL实战/MySQL优化 /大数据实战/ Python/ SQL优化
数门精品课程
紧随技术发展趋势,定期优化培训教案
融入大量生产案例,贴合企业一线需求
社群陪伴学习,一次报名,可学3期
DBA、开发工程师必修课
上千位学员已华丽转身,薪资翻番,职位提升
改变已悄然发生,你还在等什么?
扫码或“阅读原文”下载知数堂精品课程试听视频
(MySQL 实战/优化、大数据实战、Python开发,及SQL优化等课程)
密码:hg3h