# Percona xtrabackup PITR from replica backup

**URL:** <https://forums.percona.com/t/percona-xtrabackup-pitr-from-replica-backup/14677>\
**Category:** Percona XtraBackup\
**Created:** [March 9, 2022, 6:49pm UTC](https://forums.percona.com/t/percona-xtrabackup-pitr-from-replica-backup/14677 "2022-03-09T18:49:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hussain\_Patel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hussain_patel/32/17808_2.png) [@Hussain\_Patel](https://forums.percona.com/u/Hussain_Patel)\
**Post date:** [March 9, 2022, 6:49pm UTC](https://forums.percona.com/t/percona-xtrabackup-pitr-from-replica-backup/14677/1 "2022-03-09T18:49:38Z")

</div>

Hi Team,

How do i get the binlog position of master to perform PITR from full backup made on replica using percona xtrabackup.

The xtrabackup\_slave\_info file on repliica does not have binary position of master when gtid is enabled.

example:  
cat xtrabackup\_slave\_info

SET GLOBAL gtid\_purged=‘13ff6abd-63d9-11ea-8394-1458d042d710:1-1084709801, 96edfe72-893b-11ec-8866-48df37209308:1-78229846, e2ee9fa7-0202-11ec-a5e3-1458d042aa68:1-2890824404’;

CHANGE MASTER TO MASTER\_AUTO\_POSITION=1;

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [March 10, 2022, 11:38am UTC](https://forums.percona.com/t/percona-xtrabackup-pitr-from-replica-backup/14677/2 "2022-03-10T11:38:39Z")

</div>

Hello, the xtrabackup\_binlog\_info should have the binlog coordinates and the gtid info of the backup. Check [Working with Binary Logs - Percona XtraBackup](https://www.percona.com/doc/percona-xtrabackup/2.4/xtrabackup_bin/working_with_binary_logs.html) for more info

---

<div class="post-metadata">

**Author:** ![Hussain\_Patel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hussain_patel/32/17808_2.png) [@Hussain\_Patel](https://forums.percona.com/u/Hussain_Patel)\
**Post date:** [March 10, 2022, 3:57pm UTC](https://forums.percona.com/t/percona-xtrabackup-pitr-from-replica-backup/14677/3 "2022-03-10T15:57:26Z")

</div>

Hi Igroene,

The xtrabackup\_binlog\_info file has binlog info of replica and not primary when i take backup on replica.

How to i get the primary binlog info ?

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [March 11, 2022, 11:49am UTC](https://forums.percona.com/t/percona-xtrabackup-pitr-from-replica-backup/14677/4 "2022-03-11T11:49:14Z")

</div>

The primary’s binlog coordinates are not recorded in xtrabackup\_slave\_info on a gtid environment since the replica doesn’t have that info. You are supposed to use master\_auto\_position to set up replication after restoring the backup.  
If I understand correctly what you want to do, to roll forward the replica’s backup using the primary’s logs you can use mysqlbinlog with the --skip-gtids option and provide all the available files from the master.

---

<div class="post-metadata">

**Author:** ![Hussain\_Patel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hussain_patel/32/17808_2.png) [@Hussain\_Patel](https://forums.percona.com/u/Hussain_Patel)\
**Post date:** [March 11, 2022, 4:34pm UTC](https://forums.percona.com/t/percona-xtrabackup-pitr-from-replica-backup/14677/5 "2022-03-11T16:34:17Z")

</div>

Okay. Thanks.

Can you point me to any document of it to use --skip-gtids and do  
PITR.

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [March 11, 2022, 5:06pm UTC](https://forums.percona.com/t/percona-xtrabackup-pitr-from-replica-backup/14677/6 "2022-03-11T17:06:52Z")

</div>

Sorry I made a typo above. The option to exclude gtid sets is called --exclude-gtids. Basically you feed all the binary logs in order, and then skip the gtids you don’t need. For example:

> mysqlbinlog --exclude-gtids=‘7aab582d-a12c-11ec-9bf1-080027d5f945:6’ binlog.000002 binlog.000003 | mysql -uroot -p

This assuming that you have all the bin logs to fill in the gtid gaps since the backup.

You might also want to check out the process described here [MySQL Point in Time Recovery the Right Way](https://www.percona.com/blog/2017/10/23/mysql-point-in-time-recovery-right-way/)
