Make a Streaming Backup

Stream mode sends the backup to STDOUT in tar format instead of copying it to the directory named by the first argument. You can pipe the output to gzip, or across the network to another server.

To extract the resulting tar file, you must use the -i option, such as tar -ixvf backup.tar.

Warning

Remember to use the -i option for extracting a tarred backup. For more information, see Streaming and Compressing Backups.

Here are some examples using tar option for streaming:

  • Stream the backup into a tar archived named ‘backup.tar’

    $ innobackupex --stream=tar ./ > backup.tar
  • The same, but compress it

    $ innobackupex --stream=tar ./ | gzip - > backup.tar.gz
  • Encrypt the backup

    $ innobackupex --stream=tar . | gzip - | openssl des3 -salt -k "password" > backup.tar.gz.des3
  • Send it to another server instead of storing it locally

    $ innobackupex --stream=tar ./ | ssh user@desthost "cat - > /data/backups/backup.tar"
  • The same thing with can be done with the ‘’netcat’‘.

    ## On the destination host:
    $ nc -l 9999 | cat - > /data/backups/backup.tar
    ## On the source host:
    $ innobackupex --stream=tar ./ | nc desthost 9999
  • The same thing, but done as a one-liner:

    $ ssh user@desthost "( nc -l 9999 > /data/backups/backup.tar & )" \
    && innobackupex --stream=tar ./  |  nc desthost 9999
  • Throttling the throughput to 10MB/sec. This requires the ‘pv’ tools; you can find them at the official site or install it from the distribution package (“apt-get install pv”)

    $ innobackupex --stream=tar ./ | pv -q -L10m \
    | ssh user@desthost "cat - > /data/backups/backup.tar"
  • Checksumming the backup during the streaming

    ## On the destination host:
    $ nc -l 9999 | tee >(sha1sum > destination_checksum) > /data/backups/backup.tar
    ## On the source host:
    $ innobackupex --stream=tar ./ | tee >(sha1sum > source_checksum) | nc desthost 9999
    ## compare the checksums
    ## On the source host:
    $ cat source_checksum
    65e4f916a49c1f216e0887ce54cf59bf3934dbad  -
    ## On the destination host:
    $ destination_checksum
    65e4f916a49c1f216e0887ce54cf59bf3934dbad  -

Examples using xbstream option for streaming:

  • Stream the backup into a tar archived named ‘backup.xbstream

    innobackupex --stream=xbstream ./ > backup.xbstream
  • The same but with compression

    innobackupex --stream=xbstream --compress ./ > backup.xbstream
  • To unpack the backup to the current directory:

    xbstream -x <  backup.xbstream
    
  • Sending backup compressed directly to another host and unpacking it:

    innobackupex --compress --stream=xbstream ./ | ssh user@otherhost "xbstream -x"
  • Parallel compression with parallel copying backup

    innobackupex --compress --compress-threads=8 --stream=xbstream --parallel=4 ./ > backup.xbstream
Percona XtraBackup
Call Us
+1-888-316-9775 (USA - Sales)
+1-208-473-2904 (USA - Sales)
+44-208-133-0309 (UK - Sales)
0-800-051-8984 (UK - Sales)
0-800-181-0665 (GER - Sales)
+1-877-862-4316 (Emergency)
+1-855-55TRAIN (Training)
+1-925-271-5054 (Training)

Previous topic

Make a Local Full Backup (Create, Prepare and Restore)

Next topic

Making an Incremental Backup

This Page



© Copyright 2009-2014, Percona LLC and/or its affiliates.
Except where otherwise noted, this documentation is licensed under the following license:
CC Attribution-ShareAlike 2.0 Generic
Created using Sphinx 1.1.3.
This documentation is developed in Launchpad as part of the Percona XtraBackup source code.
If you spotted innacuracies, errors, don't understood it or you think something is missing or should be improved, please file a bug.
]]>