I have a MySQL master/slave configuration

 --------        --------  
| master |  ->  | slave1 |
 --------        --------  

I want to kill my current master, transform slave1 to be the new master and have another slave pointing to slave1

 --------          ------------        --------
| master |        | new master |  ->  | slave2 |
 --------          ------------        --------

What is the best way to do this without database downtime? I am using MariaDB 10.0.17

1 Answer 1


I would say your basic process is quite straight forward.

1) Ensure that slave1 has got log-bin and log-slave-updates enabled (this will require a restart if not)

2) Take a copy of Slave1 and set up Slave2 as a slave of Slave1. You now have Master -> Slave1 -> Slave2

3) Once you are happy that Slave2 is performing as expected, set GLOBAL READ_ONLY=on on the master, and move all your writes to the Slave1.

4) Once this has completed, Shut down the master.

The only downtime you would have would be restarting Slave1 if required, and the time it takes to move your writes from the Master to the Slave1. This part is entirely dependent on your situation.

  • Can I follow the steps 1 to 6 of this page (percona.com/doc/percona-xtrabackup/2.1/howtos/…) to the Slave1 copy? Commented Mar 27, 2015 at 14:43
  • 1
    Yes, that's as good a way as any (of course where that page talks about the Master you would be looking at your Slave1).
    – IGGt
    Commented Mar 27, 2015 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.