MySQL/MariaDB Backup to S3 is not working while using xtrabackup feature

xtrabackup --backup --stream=xbstream --extra-lsndir=/tmp --target-dir=/tmp | xbcloud put --storage=s3 --s3-endpoint=‘s3.amazonaws.com’ --s3-access-key=‘XXXXXXXXXXX’ --s3-secret-key=‘YYYYYYYYYYYYYYY’ --s3-bucket=‘abcd’ --parallel=10 ${date -I}-full_backup

-bash: ${date -I}-tk-full_backup: bad substitution

xtrabackup: recognized server arguments: --datadir=/var/lib/mysql

xtrabackup: recognized client arguments: --backup=1 --stream=xbstream --extra-lsndir=/tmp --target-dir=/tmp

201014 07:28:35 version_check Connecting to MySQL server with DSN ‘dbi:mysql:;mysql_read_default_group=xtrabackup’ (using password: NO).

201014 07:28:35 version_check Connected to MySQL server

201014 07:28:35 version_check Executing a version check against the server…

201014 07:28:35 version_check Done.

201014 07:28:35 Connecting to MySQL server host: localhost, user: not set, password: not set, port: not set, socket: not set

Using server version 5.5.65-MariaDB

xtrabackup version 2.4.20 based on MySQL server 5.7.26 Linux (x86_64) (revision id: c8b4056)

xtrabackup: uses posix_fadvise().

xtrabackup: cd to /var/lib/mysql

xtrabackup: open files limit requested 0, set to 32768

xtrabackup: using the following InnoDB configuration:

xtrabackup: innodb_data_home_dir = .

xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend

xtrabackup: innodb_log_group_home_dir = ./

xtrabackup: innodb_log_files_in_group = 2

xtrabackup: innodb_log_file_size = 5242880

InnoDB: Number of pools: 1

201014 07:28:35 >> log scanned up to (1597945)

xtrabackup: Generating a list of tablespaces

201014 07:28:35 [01] Streaming ./ibdata1

xtrabackup: Error writing file ‘UNOPENED’ (Errcode: 32 - Broken pipe)

xb_stream_write_data() failed.

xtrabackup: Error writing file ‘UNOPENED’ (Errcode: 32 - Broken pipe)

[01] xtrabackup: Error: xtrabackup_copy_datafile() failed.

[01] xtrabackup: Error: failed to copy datafile.

201014 07:28:36 >> log scanned up to (1597945)

Best Regards,

Kiran.M.K.

Hi Kirian,

The issue is with the name you are giving to your backup. Have a look at your first line:

-bash: ${date -I}-tk-full_backup: bad substitution

Try it as:

xtarbackup [options] | xbcloud [options] $(date ‘+%Y%m%d%H%M%S’)-full_backup