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.tarThe same, but compress it
$ innobackupex --stream=tar ./ | gzip - > backup.tar.gzEncrypt the backup
$ innobackupex --stream=tar . | gzip - | openssl des3 -salt -k "password" > backup.tar.gz.des3Send 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 9999The same thing, but done as a one-liner:
$ ssh user@desthost "( nc -l 9999 > /data/backups/backup.tar & )" \ && innobackupex --stream=tar ./ | nc desthost 9999Throttling 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.xbstreamThe same but with compression
innobackupex --stream=xbstream --compress ./ > backup.xbstreamTo unpack the backup to the current directory:
xbstream -x < backup.xbstreamSending 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
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 professional services, contact Percona Sales.