Not the answer you need?
Register and ask your own question!

Restoring master from slave

yonjahyonjah EntrantCurrent User Role Novice
Hi.
I'm in the process of setting up a disaster recovery procedure and I want to verify the process.

I've read https://www.percona.com/forums/questions-discussions/percona-xtrabackup/42885-restore-master-from-slave-backup
which contains some very useful information but since promoting the current Slave is not an option I'll want to clone the slave to a new server and promote it to be the master. The existing slave should be changed to replicate data from the new master.

Here is how my setup should look like -
Server A - Master
Server B - Slave of Server A
Server C - empty

If server A crash and burnes. Since it is completely offline the current state of Server B is the latest state.
recovery steps are -
1. Stop slave on Server B
2. Use xtrabackup to clone data from Server B to C.
3. Change master on server B to point to the current binlog file and position of server C.
4. Start Slave on Server B

So After Restore -
Server A - Decommissioned
Server B - Slave of Server C
Server C - Master

Does this process makes sense ?
Is there any step I'm missing when getting the backup from the slave or changing the master?

* I do scheduled backups of the master data and binlog to allow point in time restore, but in case of a real disaster I assume the slave will hold the most up to date data

Comments

  • yonjahyonjah Entrant Current User Role Novice
    So after doing a bit of testing with mock data and servers the process described seem to be working OK.

    The only thing anyone trying to do the same need to notice is after deploying a backup done with xtrabackup the deployed server (New Master)
    starts with a blank binary log, so to get the slave syncing with the new master all that is needed is to reset the slave and point it to the new master -
    reset slave all;
    change master to MASTER_HOST="SERVER_C_IP", MASTER_USER="repl_user", MASTER_PASSWORD="repl_user_password";
    start slave;

    After running the above on the slave it will start syncing from the newly created clone.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.