0

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 |
 --------          ------------        --------
  KILLED

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

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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