I have the following code in my bash script to execute xtrabackup from a docker container:
docker run --rm -it -v /var/lib/docker/volumes/mysql_mysql_data/_data:/var/lib/mysql -v $BACKUP_DIR:/xtrabackup_backupfiles perconalab/percona-xtrabackup:8.0.32-26 xtrabackup --backup --no-defaults --compress=lz4 --host=localhost --user=root --password=p0bW9sQxtIhPrqR2 --target-dir=“$BACKUP_DIR/$MONTHLY_BACKUP”
I am getting the following output:
2023-04-10T00:03:50.730558-00:00 0 [Note] [MY-011825] [Xtrabackup] perl binary not found. Skipping the version check
2023-04-10T00:03:50.730635-00:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: not set
2023-04-10T00:03:50.742906-00:00 0 [Note] [MY-011825] [Xtrabackup] Using server version 8.0.32-24
2023-04-10T00:03:50.747317-00:00 0 [Note] [MY-011825] [Xtrabackup] Executing LOCK TABLES FOR BACKUP …
2023-04-10T00:03:50.749027-00:00 0 [Note] [MY-011825] [Xtrabackup] uses posix_fadvise().
2023-04-10T00:03:50.749103-00:00 0 [Note] [MY-011825] [Xtrabackup] cd to /var/lib/mysql/
2023-04-10T00:03:50.749142-00:00 0 [Note] [MY-011825] [Xtrabackup] open files limit requested 0, set to 1048576
2023-04-10T00:03:50.754244-00:00 0 [Note] [MY-011825] [Xtrabackup] using the following InnoDB configuration:
2023-04-10T00:03:50.754282-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_home_dir = .
2023-04-10T00:03:50.754299-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_file_path = ibdata1:12M:autoextend
2023-04-10T00:03:50.754369-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_group_home_dir = ./
2023-04-10T00:03:50.754386-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_files_in_group = 2
2023-04-10T00:03:50.754406-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_file_size = 50331648
2023-04-10T00:03:50.757398-00:00 0 [Note] [MY-011825] [Xtrabackup] inititialize_service_handles suceeded
2023-04-10T00:03:50.894304-00:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: not set
2023-04-10T00:03:50.903774-00:00 0 [Note] [MY-011825] [Xtrabackup] Redo Log Archiving is not set up.
2023-04-10T00:03:50.995048-00:00 0 [ERROR] [MY-011825] [Xtrabackup] cannot mkdir: 13 /root/backup/monthly_2023-04/
So it is failing to create the directory. How should it be? What shall I change? I am not sure is this target dir a relative path to /xtrabackup_backupfiles when running in docker? I tried different things but could not get it to work.