# mysql 5.7 withc gtid innobackupex options for master backup and new slave

**URL:** <https://forums.percona.com/t/mysql-5-7-withc-gtid-innobackupex-options-for-master-backup-and-new-slave/5642>\
**Category:** Percona XtraBackup\
**Created:** [May 29, 2017, 9:34am UTC](https://forums.percona.com/t/mysql-5-7-withc-gtid-innobackupex-options-for-master-backup-and-new-slave/5642 "2017-05-29T09:34:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![caresal](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@caresal](https://forums.percona.com/u/caresal)\
**Post date:** [May 29, 2017, 9:34am UTC](https://forums.percona.com/t/mysql-5-7-withc-gtid-innobackupex-options-for-master-backup-and-new-slave/5642/1 "2017-05-29T09:34:00Z")

</div>

- Used innobackupex with this options to get a backup from the master:  
innobackupex /var/backup/xtra --slave-info --safe-slave-backup

- The master and the (future) slave running mysql 5.7 with GTID:

# mysql -sre “show global variables”| grep gtid\_mode

gtid\_mode ON

- After moving the backup to the Slave and restoring it with:  
innobackupex --apply-log /var/backups/xtra/2017-05-26\_22-49-20/  
innobackupex --copy-back /var/backups/xtra/2017-05-26\_22-49-20/

- But Replicacion is getting errors:  
Last\_SQL\_Error: Could not execute Write\_rows event on table XXXXX; Duplicate entry ‘XXX’ for key ‘PRIMARY’, Error\_code: 1062; handler error HA\_ERR\_FOUND\_DUPP\_KEY; the event’s master log mysql-bin.002255, end\_log\_pos 1384983

My doubt is if the options --slave-info or --safe-slave-backup in a Master with GTID can cause this problems.

Thanks.

---

<div class="post-metadata">

**Author:** ![jrivera](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jrivera/32/13_2.png) [@jrivera](https://forums.percona.com/u/jrivera)\
**Post date:** [May 29, 2017, 11:06pm UTC](https://forums.percona.com/t/mysql-5-7-withc-gtid-innobackupex-options-for-master-backup-and-new-slave/5642/2 "2017-05-29T23:06:18Z")

</div>

If you want to use Xtrabackup to provision a new slave one should not use --slave-info or --safe-slave-backup. The only time you use these two variables when taking a backup is if 1) you take a backup from a slave and 2) you intend to use that backup to provision another slave replicating from the same master where the backup was taken.

---

<div class="post-metadata">

**Author:** ![caresal](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@caresal](https://forums.percona.com/u/caresal)\
**Post date:** [May 31, 2017, 2:57am UTC](https://forums.percona.com/t/mysql-5-7-withc-gtid-innobackupex-options-for-master-backup-and-new-slave/5642/3 "2017-05-31T02:57:39Z")

</div>

Thanks.  
So, those options (–slave-info and --safe-slave-backup) just when doing the backup from a slave.

At the end the real problem was GTID\_EXECUTED global variable.

When doing: mysql\> show global variables like ‘GTID\_EXECUTED’;  
The variable had an old value.

To get the new GTID Slave Running i had to do:  
mysql\> reset master;  
mysql\> SET GLOBAL gtid\_purged=“XXXXXXXXXXXXX”;  
mysql\> CHANGE MASTER TO MASTER\_HOST=“XXX”, MASTER\_USER=“XXX”, MASTER\_PASSWORD=“XXX”, MASTER\_AUTO\_POSITION = 1;  
mysql\> START SLAVE;

It was a GTID problem/miss understod more than Innobackupex Options.

---

<div class="post-metadata">

**Author:** ![jrivera](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jrivera/32/13_2.png) [@jrivera](https://forums.percona.com/u/jrivera)\
**Post date:** [May 31, 2017, 7:52am UTC](https://forums.percona.com/t/mysql-5-7-withc-gtid-innobackupex-options-for-master-backup-and-new-slave/5642/4 "2017-05-31T07:52:49Z")

</div>

are you using master\_info\_repository=TABLE perhaps? care to share your my.cnf from the master?
