Xtrabackup showing - xb_stream_read_chunk(): wrong chunk magic at offset 0x0

Hello,

I am trying to setup replication between two nodes, using xtrabackup 8.0.x version. I use to setup using innobackupex, and trying the similar way. Can’t store the backup first and then stream because of space crunch in master. Below are the logs on master.

root@MASTER_IP # xtrabackup --user=username --password='password' --slave-info --stream=xbstream --parallel=8 --safe-slave-backup | ssh root@SLAVE_IP "xbstream -x -C /var/lib/mysql/" xtrabackup: recognized server arguments: --datadir=/var/lib/mysql --innodb_buffer_pool_size=80G --innodb_log_file_size=1G --innodb_log_buffer_size=512M --innodb_file_per_table=1 --innodb_flush_method=O_DIRECT --innodb_log_files_in_group=2 --innodb_flush_log_at_trx_commit=2 --open_files_limit=65535 xtrabackup: recognized client arguments: --user=root --password=* --user=root --password=* --slave-info=1 --stream=xbstream --parallel=8 --safe-slave-backup=1 xtrabackup version 8.0.23-16 based on MySQL server 8.0.23 Linux (x86_64) (revision id: 934bc8f) xb_stream_read_chunk(): wrong chunk magic at offset 0x0.

Mysql Versions on master & slave - 8.0.23 / 8.0.25.
Xtradb versions on master & slave - 8.0.23-16 / 8.0.25-17
OS : Debian 10

What could be the issue? Any pointers greatly helpful.

Thanks

1 Like

Remove the SSH and verify that the output is in fact xbstream binary.

1 Like

Thanks for the reply.
I tried without ssh, (till | ssh…) but command exits with return code 1 and gives out xtrabackup help information.

xtrabackup  --user=username --password='password' --slave-info --stream=xbstream  --parallel=8 --safe-slave-backup 
xtrabackup: recognized server arguments: --datadir=/var/lib/mysql --innodb_buffer_pool_size=80G --innodb_log_file_size=1G --innodb_log_buffer_size=512M --innodb_file_per_table=1 --innodb_flush_method=O_DIRECT --innodb_log_files_in_group=2 --innodb_flush_log_at_trx_commit=2 --open_files_limit=65535 
xtrabackup: recognized client arguments: --user=root --password=* --user=root --password=* --slave-info=1 --stream=xbstream --parallel=8 --safe-slave-backup=1 
xtrabackup version 8.0.23-16 based on MySQL server 8.0.23 Linux (x86_64) (revision id: 934bc8f)
Open source backup tool for InnoDB and XtraDB

Copyright (C) 2009-2019 Percona LLC and/or its affiliates.
Portions Copyright (C) 2000, 2011, MySQL AB & Innobase Oy. All Rights Reserved.
........

Thanks

1 Like

Hi, I think the problem is that the main argument has not been stated: In this case –backup.

In the usage, it shows it like this:

Usage: [xtrabackup [--defaults-file=#] --backup | xtrabackup [--defaults-file=#] --prepare] [OPTIONS]

According to the documentation, there are 3 main arguments: --backup, --prepare and --copy-back. They correspond to each of the phases of the backup cycle.

Please, try adding –backup and let us know.

Best regards, E.

1 Like

Hi,
Thanks for the reply.
I am trying to bring a new slave from the master server. Earlier I had used innobackupex and now since mysql 8.0 doesnt have it, I had to use xtrabackup.
Considering my existing server where i need to take backup and move it to new slave machine doesn’t have space, can i pass slave server details to xtrabackup?
It would help if you can share the command. Also document talks about copy and restore. But i don’t want to restore on master but on newer slave, and if someone can share alternate to approach to innobackupex (copy using | then xbstream -x -C /var/lib/mysql) then innobackupex --applylog in equivalent extrbackup, it will be helpful. Thanks in advance.

Example used in 5.7
(on source server ) innobackupex --defaults-file=/etc/my.cnf --user=username --password=password --slave-info --stream=xbstream --parallel=8 --safe-slave-backup /backup | ssh SLAVE@IP "xbstream -x -C /var/lib/mysql"
(on slave server) chown mysql:mysql -R /var/lib/mysql
(on slave server) innobackupex --apply-log --use-memory=8G /var/lib/mysql
(on slave server) cat xtrabackup_binlog_info and use that to point in change master statement.

I am trying to do the similar approach in mysql 8.0 with xtrabackup. Couldn’t find any blog/links explaining stuffs hence raised the question seeking help, apologies if question is not well formatted/conveyed :slight_smile:

Thanks

1 Like

Hello Shekar,

Would you please take a look at this blog post from my colleague Fernando Mattera? He explains an efficient way to make the backup and send it as a stream to another server to set up a new replica. Streaming MySQL Backups with Percona XtraBackup - Another Alternative - Percona Database Performance Blog

I hope this works for you.

Best regards. Eduardo.

2 Likes

Thanks a lot. Let me check the blog.

1 Like