# Xtrabackup showing - xb\_stream\_read\_chunk(): wrong chunk magic at offset 0x0

**URL:** <https://forums.percona.com/t/xtrabackup-showing-xb-stream-read-chunk-wrong-chunk-magic-at-offset-0x0/11658>\
**Category:** Percona XtraDB Cluster 8.x\
**Tags:** community, mysql\
**Created:** [August 5, 2021, 5:04am UTC](https://forums.percona.com/t/xtrabackup-showing-xb-stream-read-chunk-wrong-chunk-magic-at-offset-0x0/11658 "2021-08-05T05:04:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shekar](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@shekar](https://forums.percona.com/u/shekar)\
**Post date:** [August 5, 2021, 5:04am UTC](https://forums.percona.com/t/xtrabackup-showing-xb-stream-read-chunk-wrong-chunk-magic-at-offset-0x0/11658/1 "2021-08-05T05:04:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [August 5, 2021, 2:58pm UTC](https://forums.percona.com/t/xtrabackup-showing-xb-stream-read-chunk-wrong-chunk-magic-at-offset-0x0/11658/2 "2021-08-05T14:58:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![shekar](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@shekar](https://forums.percona.com/u/shekar)\
**Post date:** [August 31, 2021, 12:56pm UTC](https://forums.percona.com/t/xtrabackup-showing-xb-stream-read-chunk-wrong-chunk-magic-at-offset-0x0/11658/3 "2021-08-31T12:56:57Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![Eduardo](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/eduardo/32/2416_2.png) [@Eduardo](https://forums.percona.com/u/Eduardo)\
**Post date:** [September 14, 2021, 6:12am UTC](https://forums.percona.com/t/xtrabackup-showing-xb-stream-read-chunk-wrong-chunk-magic-at-offset-0x0/11658/4 "2021-09-14T06:12:00Z")

</div>

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:

```auto
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](https://www.percona.com/doc/percona-xtrabackup/8.0/backup_scenarios/full_backup.htm).

Please, try adding **–backup** and let us know.

Best regards, E.

---

<div class="post-metadata">

**Author:** ![shekar](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@shekar](https://forums.percona.com/u/shekar)\
**Post date:** [September 14, 2021, 8:57am UTC](https://forums.percona.com/t/xtrabackup-showing-xb-stream-read-chunk-wrong-chunk-magic-at-offset-0x0/11658/6 "2021-09-14T08:57:35Z")

</div>

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 🙂

Thanks

---

<div class="post-metadata">

**Author:** ![Eduardo](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/eduardo/32/2416_2.png) [@Eduardo](https://forums.percona.com/u/Eduardo)\
**Post date:** [September 14, 2021, 11:33am UTC](https://forums.percona.com/t/xtrabackup-showing-xb-stream-read-chunk-wrong-chunk-magic-at-offset-0x0/11658/7 "2021-09-14T11:33:11Z")

</div>

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](https://www.percona.com/blog/2021/01/08/streaming-mysql-backups-with-percona-xtrabackup-another-alternative/)

I hope this works for you.

Best regards. Eduardo.

---

<div class="post-metadata">

**Author:** ![shekar](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@shekar](https://forums.percona.com/u/shekar)\
**Post date:** [September 15, 2021, 6:14am UTC](https://forums.percona.com/t/xtrabackup-showing-xb-stream-read-chunk-wrong-chunk-magic-at-offset-0x0/11658/8 "2021-09-15T06:14:26Z")

</div>

Thanks a lot. Let me check the blog.
