restarting master and slave machines without breaking master slave MySQL replication

All we need is an easy explanation of the problem, so here it is.

We need to resize the size (CPU and RAM) of two database servers having MySQL server 8: master and slave, but this operation implies that those machines will be restarted, And I think a restart of those machines might cause a problem in replication !

Is there a proper way to restart our machines without breaking the replication, Or I’m wrong about the fact that restarting the master and slave machines (OS) can break the replication ?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

You can stop and start master and slave in any order you want. It doesn’t matter, master first or slave first – for both stop and start.

The only requirement is master’s expire_log_days config option should be bigger than maintenance duration. Otherwise master on start will rotate its binlogs faster than slave get a sync. Keep in mind that this variable should be set statically in the my.cnf file, not dynamically via SET GLOBAL expire_log_days = X;

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply