How to get compressed backup in .xbstream format in a S3 bucket

Hey all,

I am trying to create a full backup with Amazon s3 following the steps in The xbcloud Binary - Percona XtraBackup
using the command xtrabackup --backup --user=user --password --stream=xbstream --extra-lsndir=/tmp --target-dir=/tmp | xbcloud put --storage=s3 --s3-endpoint=‘s3.amazonaws.com’ --s3-access-key=‘access_key’ --s3-secret-key=‘secret_key’ --s3-bucket=‘bucket-name’ --parallel=10 backup_name

This command works and uploads my files in s3 bucket in a folder, my question is how can I achieve the .xbstream or .tar.gz compressed version of my backup in s3 bucket. Will it be a manual step to compress it once the backup files are uploaded to s3 or do we have someother way to do it.

Appreciate any help.

1 Like

Hi @dikshagulati094 .

All you need to do is add the --compress flag to xtrabackup command:

 xtrabackup --backup --user=user --password --stream=xbstream --extra-lsndir=/tmp --target-dir=/tmp --compress --compress-threads=4 | xbcloud put --storage=s3 --s3-endpoint=‘s3.amazonaws.com’ --s3-access-key=‘access_key’ --s3-secret-key=‘secret_key’ --s3-bucket=‘bucket-name’ --parallel=10 backup_name

Then once you download the files (to restore) you just need to decompress them first.
Please check Compressed Backup - Percona XtraBackup for more details.

1 Like