~akopytov/percona-xtrabackup/bug1002688-2.1

« back to all changes in this revision

Viewing changes to doc/source/innobackupex/streaming_backups_innobackupex.rst

  • Committer: Alexey Kopytov
  • Date: 2012-05-14 15:31:43 UTC
  • mfrom: (391.1.33 staging)
  • Revision ID: akopytov@gmail.com-20120514153143-i06vj6orpdwh9qb8
Manual merge from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 Streaming and Compressing Backups
3
3
===================================
4
4
 
5
 
Streaming mode, supported by |XtraBackup|, sends backup to ``STDOUT`` in special ``tar`` 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.
8
 
 
9
 
.. warning:: If both --stream and --incremental are passed to innobackupex, the incremental parameters are ignored and a full backup is created.
10
 
 
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.
 
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::
12
10
 
13
11
 $ innobackupex --stream=tar /tmp
14
12
 
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.
 
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
==================
16
40
 
17
41
To store the backup in one archive it directly :: 
18
42
 
22
46
 
23
47
 $ innobackupex --stream=tar ./ | ssh user@destination \ "cat - > /data/backups/backup.tar"
24
48
 
25
 
.. warning::  To extract |XtraBackup| 's archive you **must** use |tar| with ``-i`` option::
 
49
.. warning::  To extract |XtraBackup|'s archive you **must** use |tar| with ``-i`` option::
26
50
 
27
51
  $ tar -xizf backup.tar.gz
28
52
 
32
56
 $ innobackupex --stream=tar ./ | bzip2 - > backup.tar.bz2
33
57
 
34
58
Note that the streamed backup will need to be prepared before restoration. Streaming mode does not prepare the backup.
 
59