290.1.1
by Rodrigo Gadea
New XtraBackup Documentation -- Requires sphinx >= 1.0 |
1 |
===================================
|
2 |
Streaming and Compressing Backups
|
|
3 |
===================================
|
|
4 |
||
391.20.1
by Hrvoje Matijakovic
* reviewed the docs and applied the changes made in PXB 2.0 |
5 |
Streaming mode, supported by |XtraBackup|, sends backup to ``STDOUT`` in special ``tar`` or |xbstream| format instead of copying files to the backup directory. |
6 |
||
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. |
|
8 |
||
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:: |
|
290.1.1
by Rodrigo Gadea
New XtraBackup Documentation -- Requires sphinx >= 1.0 |
10 |
|
11 |
$ innobackupex --stream=tar /tmp
|
|
12 |
||
391.20.1
by Hrvoje Matijakovic
* reviewed the docs and applied the changes made in PXB 2.0 |
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. |
14 |
||
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. |
|
16 |
||
17 |
Using |xbstream| as a stream option, backups can be copied and compressed in parallel which can significantly speed up the backup process. |
|
18 |
||
19 |
Examples using xbstream
|
|
20 |
=======================
|
|
21 |
||
22 |
To store the backup in one archive it directly: :: |
|
23 |
||
24 |
$ innobackupex --stream=xbstream /root/backup/ > /root/backup/backup.xbstream |
|
25 |
||
26 |
To stream and compress the backup: :: |
|
27 |
||
28 |
$ innobackupex --stream=xbstream --compress /root/backup/ > /root/backup/backup.xbstream |
|
29 |
||
30 |
To unpack the backup to the /root/backup/ directory: :: |
|
31 |
||
32 |
$ xbstream -x < backup.xbstream -C /root/backup/ |
|
33 |
||
34 |
For sending backup compressed directly to another host and unpacking it: :: |
|
35 |
||
36 |
$ innobackupex --compress --stream=xbstream /root/backup/ | ssh user@otherhost "xbstream -x -C /root/backup/" |
|
37 |
||
38 |
Examples using tar
|
|
39 |
==================
|
|
290.1.1
by Rodrigo Gadea
New XtraBackup Documentation -- Requires sphinx >= 1.0 |
40 |
|
41 |
To store the backup in one archive it directly :: |
|
42 |
||
43 |
$ innobackupex --stream=tar /root/backup/ > /root/backup/out.tar |
|
44 |
||
45 |
For sending it directly to another host by ::
|
|
46 |
||
47 |
$ innobackupex --stream=tar ./ | ssh user@destination \ "cat - > /data/backups/backup.tar"
|
|
48 |
||
391.20.1
by Hrvoje Matijakovic
* reviewed the docs and applied the changes made in PXB 2.0 |
49 |
.. warning:: To extract |XtraBackup|'s archive you **must** use |tar| with ``-i`` option:: |
290.1.1
by Rodrigo Gadea
New XtraBackup Documentation -- Requires sphinx >= 1.0 |
50 |
|
51 |
$ tar -xizf backup.tar.gz |
|
52 |
||
53 |
Choosing the compression tool that best suits you: :: |
|
54 |
||
55 |
$ innobackupex --stream=tar ./ | gzip - > backup.tar.gz |
|
56 |
$ innobackupex --stream=tar ./ | bzip2 - > backup.tar.bz2 |
|
57 |
||
58 |
Note that the streamed backup will need to be prepared before restoration. Streaming mode does not prepare the backup. |
|
391.20.1
by Hrvoje Matijakovic
* reviewed the docs and applied the changes made in PXB 2.0 |
59 |