Xtrabackup via stream on another machine question

Hello, i’ve setting up/restore slave hosts many times with one and the same scenario:

  • on master i create xtrabackup --backup and xtrabackup --prepare
  • copy dump on slave machine, add auto.cnf with slave server uuid
  • start mysql on slave, reset master, then SET global GTID_PURGED=_info_from_xtrabackup_binlog_info
  • start slave.

I thinked i understand process and what happens under the hood.
Yesterday i made the same prcedure except one difference: since i have no enought space on master to make dump i’ve done dump like this

xtrabackup --backup --no-backup-locks --no-lock --parallel=4 --stream=xbstream | socat - TCP4:remote_server:1111

on remote machine i “catch” this stream like this

socat -u tcp-listen:1111,reuseaddr stdout 2>/tmp/socat.log | xbstream -x -C mysqlbackup

All goes well, backup created successfully, on remote machine i successfully prepare backup and restore my slave with usual procedure. But after i start slave i immediatly got errors about duplicate keys, what means, that something goes wrong with my backup.
Should i use some additional options, when try to stream backup over net to another host?

Hello @Deniska80,

Would you consider not including --no-backup-locks --no-lock ?
The doc says:

Use it only if ALL your tables are InnoDB and you DO NOT CARE about the binary log position of the backup

You should use –backup-locks to have a consistent snapshot.

Would you rerun this process with locks and see if the issue repeats?


Thanks a lot, i will try.