Skip to content
Starting November 2023 Percona XtraBackup 2.4 has reached EOL status. If you have 5.7 databases, we encourage you to upgrade to 8.0 and then install Percona XtraBackup 8.0. Learn more

logo
Percona XtraBackup
Streaming and Compressing Backups
Initializing search
    percona/pxb-docs
    percona/pxb-docs
    • Home
      • About Percona XtraBackup
      • How Percona XtraBackup Works
      • Understand version numbers
      • Installing Percona XtraBackup 2.4
      • Installing Percona XtraBackup on Debian and Ubuntu
      • Installing Percona XtraBackup on Red Hat Enterprise Linux and CentOS
      • Installing Percona XtraBackup from a Binary Tarball
      • Compiling and Installing from Source Code
      • Running Percona XtraBackup in a Docker container
      • Connection and Privileges Needed
      • Configuring xtrabackup
      • The Backup Cycle - Full Backups
      • Incremental Backup
      • Compressed Backup
      • Encrypted Backup
      • Percona XtraBackup User Manual
      • Throttling Backups
      • Lockless binary log information
      • Encrypted InnoDB Tablespace Backups
      • lock-ddl-per-table Option Improvements
      • How-tos and Recipes
        • Release notes index
        • Percona XtraBackup 2.4.29 (2023-12-18)
        • Percona XtraBackup 2.4.28 (2023-04-04)
        • Percona XtraBackup 2.4.27 (2022-12-06)
        • Percona XtraBackup 2.4.26
        • Percona XtraBackup 2.4.25
        • Percona XtraBackup 2.4.24
        • Percona XtraBackup 2.4.23
        • Percona XtraBackup 2.4.22
        • Percona XtraBackup 2.4.21
        • Percona XtraBackup 2.4.20
        • Percona XtraBackup 2.4.19
        • Percona XtraBackup 2.4.18
        • Percona XtraBackup 2.4.17
        • Percona XtraBackup 2.4.16
        • Percona XtraBackup 2.4.15
        • Percona XtraBackup 2.4.14
        • Percona XtraBackup 2.4.13
        • Percona XtraBackup 2.4.12
        • Percona XtraBackup 2.4.11
        • Percona XtraBackup 2.4.10
        • Percona XtraBackup 2.4.9
        • Percona XtraBackup 2.4.8
        • Percona XtraBackup 2.4.7-2
        • Percona XtraBackup 2.4.7
        • Percona XtraBackup 2.4.6
        • Percona XtraBackup 2.4.5
        • Percona XtraBackup 2.4.4
        • Percona XtraBackup 2.4.3
        • Percona XtraBackup 2.4.2
        • Percona XtraBackup 2.4.1
      • The xtrabackup Option Reference
      • The innobackupex Option Reference
      • The xbcloud Binary
      • Exponential Backoff
      • Using the xbcloud binary with Microsoft Azure Cloud Storage
      • The xbcrypt binary
      • The xbstream binary
      • Known issues and limitations
      • Frequently Asked Questions
      • Glossary
      • Index of files created by Percona XtraBackup
      • Trademark policy
      • Copyright and licensing information
      • Version Checking

    • Examples using xbstream
    • Examples using tar

    Streaming and Compressing Backups¶

    Streaming mode, supported by Percona XtraBackup, sends backup to STDOUT in special tar or xbstream format instead of copying files to the backup directory.

    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.

    To use the streaming feature, you must use the innobackupex --stream, providing the format of the stream (tar or xbstream ) and where to store the temporary files:

    $ innobackupex --stream=tar /tmp
    

    innobackupex 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.

    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.

    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.

    Examples using xbstream¶

    Store the complete backup directly to a single file:

    $ innobackupex --stream=xbstream /root/backup/ > /root/backup/backup.xbstream
    

    To stream and compress the backup:

    $ innobackupex --stream=xbstream --compress /root/backup/ > /root/backup/backup.xbstream
    

    To unpack the backup to the /root/backup/ directory:

    $ xbstream -x <  backup.xbstream -C /root/backup/
    

    To send the compressed backup to another host and unpack it:

    $ innobackupex --compress --stream=xbstream /root/backup/ | ssh user@otherhost "xbstream -x -C /root/backup/"
    

    Examples using tar¶

    Store the complete backup directly to a tar archive:

    $ innobackupex --stream=tar /root/backup/ > /root/backup/out.tar
    

    To send the tar archive to another host:

    $ innobackupex --stream=tar ./ | ssh user@destination \ "cat - > /data/backups/backup.tar"
    

    Note

    To extract Percona XtraBackup’s archive you must use tar with -i option:

     $ tar -xizf backup.tar.gz
    
    Compress with your preferred compression tool:

    $ innobackupex --stream=tar ./ | gzip - > backup.tar.gz
    $ innobackupex --stream=tar ./ | bzip2 - > backup.tar.bz2
    

    Note that the streamed backup will need to be prepared before restoration. Streaming mode does not prepare the backup.

    Contact us

    For free technical help, visit the Percona Community Forum.

    To report bugs or submit feature requests, open a JIRA ticket.

    For paid support and managed or consulting services , contact Percona Sales.

    2024-04-09
    Percona LLC and/or its affiliates, © 2024 Cookie Preferences
    Made with Material for MkDocs