2
2
Streaming and Compressing Backups
3
3
===================================
5
Streaming mode, supported by |XtraBackup|, sends backup to ``STDOUT`` in special ``tar`` format instead of copying files to the backup directory.
7
This allows to pipe the stream to other programs, providing great flexibility to the output of it. For example, compression is achieved by piping the output to a compression utility.
9
.. warning:: If both --stream and --incremental are passed to innobackupex, the incremental parameters are ignored and a full backup is created.
11
To use this feature, you must use the :option:`--stream`, providing the format of the stream (only ``tar`` is supported at this moment) and where should the store the temporary files::
5
Streaming mode, supported by |XtraBackup|, sends backup to ``STDOUT`` in special ``tar`` or |xbstream| format instead of copying files to the backup directory.
7
This allows to pipe the stream to other programs, providing great flexibility to the output of it. 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.
9
To use the streaming feature, you must use the :option:`--stream`, providing the format of the stream (``tar`` or ``xbstream`` ) and where should the store the temporary files::
13
11
$ innobackupex --stream=tar /tmp
15
|innobackupex| starts |xtrabackup| in :option:`--log-stream` mode in a child process, and redirects its log to a temporary file. It then uses |tar4ibd| to stream all of the data files to ``STDOUT``, in a special ``tar`` format. See :doc:`../tar4ibd/tar4ibd_binary` for details. After it finishes streaming all of the data files to ``STDOUT``, it stops xtrabackup and streams the saved log file too.
13
|innobackupex| starts |xtrabackup| in :option:`--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 :doc:`../xbstream/xbstream` for details. After it finishes streaming all of the data files to ``STDOUT``, it stops xtrabackup and streams the saved log file too.
15
When compression is enabled, |xtrabackup| compresses all output data, including the transaction log file and meta data files, 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 <http://www.quicklz.com/>`_. New algorithms (gzip, bzip2, etc.) may be added later with minor efforts.
17
Using |xbstream| as a stream option, backups can be copied and compressed in parallel which can significantly speed up the backup process.
19
Examples using xbstream
20
=======================
22
To store the backup in one archive it directly: ::
24
$ innobackupex --stream=xbstream /root/backup/ > /root/backup/backup.xbstream
26
To stream and compress the backup: ::
28
$ innobackupex --stream=xbstream --compress /root/backup/ > /root/backup/backup.xbstream
30
To unpack the backup to the /root/backup/ directory: ::
32
$ xbstream -x < backup.xbstream -C /root/backup/
34
For sending backup compressed directly to another host and unpacking it: ::
36
$ innobackupex --compress --stream=xbstream /root/backup/ | ssh user@otherhost "xbstream -x -C /root/backup/"
17
41
To store the backup in one archive it directly ::